pyTooling.CLIAbstraction.Flag
Flag arguments represent simple boolean values by being present or absent.
See also
For flags with different pattern based on the boolean value itself.
→BooleanFlag
For flags with a value.
→ValuedFlag
For flags that have an optional value.
→NamedOptionalValuedFlag
Classes
FlagArgument
: Base-class for all Flag classes, which represents a simple flag argument like-v
or--verbose
.ShortFlag
: Represents aFlag
argument with a single dash.LongFlag
: Represents aFlag
argument with a double dash.WindowsFlag
: Represents aFlag
argument with a single slash.
Classes
- class pyTooling.CLIAbstraction.Flag.FlagArgument(*args: Any, **kwargs: Any)[source]
Base-class for all Flag classes, which represents a simple flag argument like
-v
or--verbose
.A simple flag is a single value (absent/present or off/on) with no additional data (value).
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.
- classmethod __init_subclass__(*args, name=None, pattern='{0}', **kwargs)
This method is called when a class is derived.
- __repr__()
Return a string representation of this argument instance.
- Return type:
- Returns:
Argument formatted and enclosed in double quotes.
- class pyTooling.CLIAbstraction.Flag.ShortFlag(*args: Any, **kwargs: Any)[source]
Represents a
Flag
argument with a single dash.Example:
-optimize
Inheritance
- classmethod __init_subclass__(*args, pattern='-{0}', **kwargs)[source]
This method is called when a class is derived.
- 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.Flag.LongFlag(*args: Any, **kwargs: Any)[source]
Represents a
Flag
argument with a double dash.Example:
--optimize
Inheritance
- classmethod __init_subclass__(*args, pattern='--{0}', **kwargs)[source]
This method is called when a class is derived.
- 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.Flag.WindowsFlag(*args: Any, **kwargs: Any)[source]
Represents a
Flag
argument with a single slash.Example:
/optimize
Inheritance
- classmethod __init_subclass__(*args, pattern='/{0}', **kwargs)[source]
This method is called when a class is derived.
- 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.