minicli is a minimalist OCaml library for command line parsing.
To get it:
opam update && opam install minicli
The code:
A usage example:
Competing libraries are the Arg module from the stdlib (but client programs are a little painful to maintain) or Daniel Bunzli’s cmdliner library (which is overkill for many applications).
If you use the Arg module, I suggest you give a try at minicli.
Competing libraries are the Arg module from the stdlib (but client programs are a little painful to maintain) or Daniel Bunzli’s cmdliner library (which is overkill for many applications).
And Core.Command (which is not as featureful as cmdliner, but more than minimal, and has nice illustrations in RWO).
It avoids maintaining separate manpages and help messages (thanks to its declarative style), it’s more than a parsing library! I think it leads to better coding standards since you can’t mix parsing with your program’s real work.
I know my user base (me). I find Core.Command’s option documentation features quite adequate; I do like to be able to get a reminder of the syntax I’ve specified, because it’s complicated, and Command provides helpful non-man style output for this purpose. I could imagine needing less for some apps, however.
Users of minicli are supposed to write and maintain a usage message.
All my programs print it when they are called without any parameter (not even require a -h/–help).