* [Caml-list] Command line argument parsing
@ 2010-12-27 17:32 Goswin von Brederlow
0 siblings, 0 replies; only message in thread
From: Goswin von Brederlow @ 2010-12-27 17:32 UTC (permalink / raw)
To: caml-list
Hi,
I'm looking for a better (as more suitable to my wishes :) module to do
command line argument parsing.
So far I've looked at Arg and Getopt. Args has a nice automatic help
text while Getopt supports short and long options. I want both. :)
Further both only allow parsing all option in one go.
So what am I looking for?
=========================
Consider the following usage:
foo [-p|--port <num>] [-h|--help] [-v|--verbose] [[-f|--file] <name>] [...]
port defaults to 1234
Then I want to write something like:
let port_arg = Int [Short 'p'; Long "port"; Once; Default 1234]
let help_arg = Unit [Short 'h'; Long "help"; Exit; ]
let verbose_arg Count [Short 'v'; Long "verbose" ]
let file_arg = Call_String ([Short 'f'; Long "file" ], (fun s -> process s))
let port = extract port_arg
let verbose = extract verbose_arg
let () = extract help_arg
let () = parse [file_arg] (fun s -> process s) "Help text header"
I don't want to have to use a ref or mutable to define a port and then
overwrite it when parsing the arguments.
Anyone know something in that direction?
MfG
Goswin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-27 17:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27 17:32 [Caml-list] Command line argument parsing Goswin von Brederlow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox