pyTooling.CLIAbstraction.Command
This module implements command arguments. Usually, commands are mutually exclusive and the first argument in a list of arguments to a program.
While commands can or cannot have prefix characters, they shouldn’t be confused with flag arguments or string arguments.
Example:
prog command -arg1 --argument2
See also
For simple flags (various formats).
→Flag
For string arguments.
→StringArgument
Classes
CommandArgument
: Represents a command argument.ShortCommand
: Represents a command name with a single dash.LongCommand
: Represents a command name with a double dash.WindowsCommand
: Represents a command name with a single slash.
Classes
- class pyTooling.CLIAbstraction.Command.CommandArgument[source]
Represents a command argument.
It is usually used to select a sub parser in a CLI argument parser or to hand over all following parameters to a separate tool. An example for a command is ‘checkout’ in
git.exe checkout
, which callsgit-checkout.exe
.Example:
command
Inheritance
- AsArgument()
Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name.
- Return type:
- Returns:
Formatted argument.
- Raises:
ValueError – If internal name is None.
- __repr__()
Return a string representation of this argument instance.
- Return type:
- Returns:
Argument formatted and enclosed in double quotes.
- class pyTooling.CLIAbstraction.Command.ShortCommand[source]
Represents a command name with a single dash.
Example:
-command
Inheritance
- AsArgument()
Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name.
- Return type:
- Returns:
Formatted argument.
- Raises:
ValueError – If internal name is None.
- __repr__()
Return a string representation of this argument instance.
- Return type:
- Returns:
Argument formatted and enclosed in double quotes.
- class pyTooling.CLIAbstraction.Command.LongCommand[source]
Represents a command name with a double dash.
Example:
--command
Inheritance
- AsArgument()
Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name.
- Return type:
- Returns:
Formatted argument.
- Raises:
ValueError – If internal name is None.
- __repr__()
Return a string representation of this argument instance.
- Return type:
- Returns:
Argument formatted and enclosed in double quotes.
- class pyTooling.CLIAbstraction.Command.WindowsCommand[source]
Represents a command name with a single slash.
Example:
/command
Inheritance
- AsArgument()
Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name.
- Return type:
- Returns:
Formatted argument.
- Raises:
ValueError – If internal name is None.
- __repr__()
Return a string representation of this argument instance.
- Return type:
- Returns:
Argument formatted and enclosed in double quotes.