Command_Parameters Module

The CommandParameters class in this module is used to process all of the attributes of a given Command when it is defined to collect its Parameter / ParamGroup members. It also checks for conflicts between parameter definitions.

It has some involvement in the parsing process for BaseOption parameters.

author:

Doug Skrypa

class cli_command_parser.command_parameters.CommandParameters(command: CommandCls, command_parent: CommandCls | None, parent_params: CommandParameters | None, config: CommandConfig)[source]

Bases: object

action: Action | None = None

An Action Parameter, if specified

sub_command: SubCommand | None = None

A SubCommand Parameter, if specified

action_flags: ActionFlags

List of action flags

split_action_flags: tuple[ActionFlags, ActionFlags]

Action flags split by before/after main

options: list[BaseOption]

List of optional Parameters

combo_option_map: OptionMap

Mapping of {short opt: Parameter} (no dash characters)

groups: list[ParamGroup]

List of ParamGroup objects

positionals: list[BasePositional]

List of positional Parameters

option_map: OptionMap

Mapping of {–opt / -opt: Parameter}

command: CommandCls

The Command associated with this CommandParameters object

command_parent: CommandCls | None

The parent Command, if any

parent: CommandParameters | None

The parent Command’s CommandParameters

property pass_thru: PassThru | None[source]
property has_nested_pass_thru: bool[source]
property all_positionals: list[BasePositional][source]
get_positionals_to_parse(ctx: Context) list[BasePositional][source]
property formatter: CommandHelpFormatter[source]

The formatter used for this Command’s help text

short_option_to_param_value_pairs(option: str) tuple[list[tuple[str, BaseOption, str | None]], bool][source]
iter_params(exclude: Collection[Parameter] = ()) Iterator[Parameter][source]
required_check_params() Iterator[Parameter][source]