Arger
Function
Function's signature is used to create generate parser arguments.
1. Positional Arguments:
Positional parameters become mandatory.
2. Optional Arguments:
All keyword arguments (ones with default value) in the function become flags/optionals.
3. type annotations:
used to determine the type and action of the arguments.
The function will be dispatched with values converted to the respective types.
Note: Use arger.Argument
class as annotation in case you want to pass values to parser.add_argument
.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
4. Docstring (ReST or GoogleDoc)
- The top part of the docstring becomes the usage message for the command.
- Parameter docstrings become help message for the arguments/options of the command.
- Rest of the docstrings passed as
epilog
to the parser. - ReST/GoogleDoc-style/NumpyDoc-style are supported
- Options-strings can further be defined in the docstring.
1 2 3 4 5 |
|