command-line parsing with hierarchical sub-commands
create ~autocomplete ~summary ~usage_arg ~init ~flags ~final main
constructs a base command from the following data:
'accum
a mutable accumulator type for gathering arguments'args
a composite argument type for the command, build from 'accum
autocomplete
an optional argument defining a bash autocompletion
function for the base command.summary
a short description of what the command doesreadme
a longer description of what the command doesusage_arg
an abbreviation of the arguments it expectsinit
a function that creates an mutable
accumulator of type 'accum
flags
a list of command line flags together with their
associated accumulator-mutating actionsfinal
a function that constructs the final argument
structure of type 'args
from the accumulated arguments.
The second argument to the function is the list of all
annonymous arguments. This function should raise an
exception with some explanation if it is unable to
construct a complete value of type 'args
.help
an optional function that will be called to generate help
for a command instead of the standard helpmain
the main function, parameterized by the argument structuregroup ~summary [...; (name_i, t_i); ...]
is an aggregate command
that dispatches to one of the named sub-commands. A "help"
sub-command will also be generated for the group.
The name cannot contain underscores, however passing allow_underscores=true
into run
will parse underscores as dashes on the command line.