On Dec 27, 2008, at 3:23 AM, Derick Eddington wrote:
I've always thought, when you don't need more complex command-line
arguments handling, the apply case-lambda is really slick.
It's still a little too verbose for such a simple thing.
SRFI-37, available as library (xitomatl srfi args-fold), does POSIX
and
GNU -style handling. http://srfi.schemers.org/srfi-37/srfi-37.html
I don't like! Too complex.
Also, I like handling them using apply of a procedure which uses a
matcher on the arguments.
That may be okay, but making it follow the "expected" behavior
is a little too painful.
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 ---)
Aziz,,,