Hi all, I am new to the ocaml eco system. I want to build a CLI that deviates a bit from the common POSIX / GNU standards. The grammar is summarized as follows:
cmd subcommand [named arguments] [positional arguments] [named arguments]
Important deviations:
- named arguments may not have the
--
prefix, and follow the syntaxflag=value
orflag = 'value with spaces'
instead of--flag value
. - some of the flags may be defined at runtime. An example of how this may work:
cmd subcommand --extra-fields='fieldA' fieldA=someValue
or a --config argument could be provided where these fields are defined. A field must not be used prior to its definition.
From the looks of it, the popular cmdliner
does not support this. Are there any alternatives to just… Parsing sys argv by hand with a ton of if-statements and pattern matches?
Should I be using parsers like Angstrom?