ParamDef
A parameter definition is the low-level building block to define the grammar of a command-line and its functionality.
ParamDefs associate parameter names to actions that are invoked by Parser.parse().
Attributes
- endOfNamed
Treat all subsequent parameters as positionals, regardless of their name. This can be useful for constructing nested commands.
- isFlag
Indicates if this named parameter is a flag, i.e. one that never accepts an argument. In case its name is encountered, its value is set to "true". Has no effect on positional parameters.
- missing
A function that is invoked if this parameter has not been encountered at all.
- names
All names that may be used by this parameter. If a name starts with
-
, it is considered a "named" parameter, otherwise it is considered a "positional" parameter. Arguments associated to named parameters may appear in any order on the command line, as long as they are prefixed by the parameter's name. Positional parameters are given arguments in the order they appear in. Special case for single-letter named parameters: one argument may specify multiple named parameters of a single letter. In this case, letters are read left to right, and the first non-flag parameter will consume the remaining letters. E.g. assume-i
and-t
are flags, and-I
takes an argument, then-itIhello
sets-i
and-t
and assignshello
to-I
.- parseAndSet
A function that is invoked anytime this parameter is encountered on the command line. In case of a named param, the first element is the actual name used, and the second element is the argument or None if no argument followed. In case of a positional param, the parameter's first name is given and the argument value is always defined. This function must return either a
Continue
orStop
. The former will instruct the parser to continue parsing, whereas the latter will prevent any further argument parsing.- repeatPositional
If this is a positional parameter, the parser will repeat it indefinitely.
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any