The module contains routines to parse command arguments and map them to
the command handler's positonal and keyword arguments.
Mapping is done in two stages: 1) parse arguments into positional
arguments and options; 2) adapt them to the specific command handler
according to the command properties.
|
|
parse_arguments(arguments)
Simple yet effective and sufficient in most cases parser which
parses command arguments and returns them as two lists. |
source code
|
|
|
|
adapt_arguments(command,
arguments,
args,
opts)
Adapt args and opts got from the parser to a specific handler by
means of arguments specified on command definition. That is
transform them to *args and **kwargs suitable for passing to a
command handler. |
source code
|
|
|
|
generate_usage(command,
complete=True)
Extract handler's arguments specification and wrap them in a
human-readable format usage information. If complete is given - then
USAGE_PATTERN will be used to render the specification completly. |
source code
|
|