Actions Module
Parameter actions define how Parameters behave when processing values that were provided via CLI or environment variables.
- class cli_command_parser.parameters.actions.ParamAction(param: Param)[source]
Bases:
ABC
- default: TD = <object object>
- classmethod __init_subclass__(default: ~cli_command_parser.parameters.actions.TD = <object object>, accepts_values: bool = None, accepts_consts: bool = None, **kwargs)[source]
- param
- abstract add_value(value: str, *, combo: bool = False, joined: bool = False, env_var: str = None) int | NoReturn [source]
Execute this action for the given Parameter and value.
- Parameters:
value¶ – The value that was provided, if any.
combo¶ – Only True when a short option was provided, where the option string was combined with either a real value or a sequence of 1-char combinable versions of short option strings.
joined¶ – True if the value was provided as
--option=value
, False otherwise.env_var¶ – The name of the environment variable that was used as the source of the given value, if applicable.
- Returns:
The number of new values discovered
- class cli_command_parser.parameters.actions.ValueMixin[source]
Bases:
object
- param: Param
- get_default: Callable
- class cli_command_parser.parameters.actions.ConstMixin[source]
Bases:
object
- param: Param
- get_default: Callable
- add_const: Callable
- add_value: Callable
- class cli_command_parser.parameters.actions.Store(param: Param)[source]
Bases:
ValueMixin
,ParamAction
- default_nargs = Nargs(1)
- add_value(value: str, *, combo: bool = False, joined: Bool = False, env_var: str = None) Found [source]
- default: TD = None
- class cli_command_parser.parameters.actions.Append(param: Param)[source]
Bases:
ValueMixin
,ParamAction
- default_nargs = Nargs('+')
- add_value(value: str, *, combo: bool = False, joined: Bool = False, env_var: str = None) Found [source]
- class cli_command_parser.parameters.actions.BasicConstAction(param: Param)[source]
Bases:
ConstMixin
,ParamAction
,ABC
- default_nargs = Nargs(0)
- class cli_command_parser.parameters.actions.StoreConst(param: Param)[source]
Bases:
BasicConstAction
- default: TD = None
- class cli_command_parser.parameters.actions.AppendConst(param: Param)[source]
Bases:
BasicConstAction
- class cli_command_parser.parameters.actions.Count(param: Param)[source]
Bases:
ParamAction
- default_nargs = Nargs('?')