On Dec 27, 11:24 am, Abdulaziz Ghuloum <[email protected]> wrote:
> How about (just brainstorming):
>
> (process-command-line
>    ([all? short: "A" long: "all" default: #f
>           "List all entries except for . and ...  Always set \
>            for the superuser."]
>     [rec? short: "R" long: "recursive" default: #f
>           "Recursively list subdirectories encountered."]
>     [sorter short: "s" long: "sort" default: (lambda (x y) #f)
>             values: ([ascending  string<?] [descending string>?])
>             "Sort"]
>     .
>     filenames)
>    --- expr using all?, rec?, sorter?, and filenames ---)
>
> process-command-line should take care of the rest, including
> producing the appropriate error messages, usage, etc.
>
> The shorthand if you don't care about all of these would be:
>
> (process-command-line (filename)
>    --- expr using filename ---)
>
> (process-command-line filenames
>    --- expr using filenames ---)

Yeah, command-line processors that do it all based on what you declare
are the best.  Years ago, I made one for the D language and one for
Modula-3.  I was about to make one for R6RS a few months ago but
didn't need the sophistication yet and wanted to try out doing it with
my matcher.  If you make one before me, I'll assimilate and maintain
it.

--
: Derick
----------------------------------------------------------------

Reply via email to