API Reference argparse v2.0.0
modules
Modules
Command line parser, made with hierarchy of commands in mind. Parser operates with arguments and commands, organised in a hierarchy. It is possible to define multiple commands, or none. Parsing always starts with root command, named after
init:get_argument(progname)
. Empty command produces empty argument map: 1> parse("", #{}).
#{}
If root level command does not contain any sub-commands, parser returns plain map of argument names to their values: 3> args:parse(["value"], #{arguments => [#{name => arg}]}).
#{arg => "value"}
This map contains all arguments matching command line passed, initialised with corresponding values. If argument is omitted, but default value is specified for it, it is added to the map. When no default value specified, and argument is not present, corresponding key is not present in the map.
Command line utility behaviour. Usage example