class documentation

A multi command is the basic implementation of a command that dispatches to subcommands. The most common version is the :class:`Group`. :param invoke_without_command: this controls how the multi command itself is invoked. By default it's only invoked if a subcommand is provided. :param no_args_is_help: this controls what happens if no arguments are provided. This option is enabled by default if `invoke_without_command` is disabled or disabled if it's enabled. If enabled this will add ``--help`` as argument if no arguments are passed. :param subcommand_metavar: the string that is used in the documentation to indicate the subcommand place. :param chain: if this is set to `True` chaining of multiple subcommands is enabled. This restricts the form of commands in that they cannot have optional arguments but it allows multiple commands to be chained together. :param result_callback: The result callback to attach to this multi command. This can be set or changed later with the :meth:`result_callback` decorator.

Method __init__ Undocumented
Method collect_usage_pieces Returns all the pieces that go into the usage line and returns it as a list of strings.
Method format_commands Extra format methods for multi methods that adds all the commands after the options.
Method format_options Writes all the options into the formatter if they exist.
Method get_command Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`.
Method invoke Given a context, this invokes the attached callback (if it exists) in the right way.
Method list_commands Returns a list of subcommand names in the order they should appear.
Method parse_args Given a context and a list of arguments this creates the parser and parses the arguments, then modifies the context as necessary. This is automatically invoked by :meth:`make_context`.
Method resolve_command Undocumented
Method result_callback Adds a result callback to the command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcommand (or the list of return values from all subcommands if chaining is enabled) as well as the parameters as they would be passed to the main callback.
Method shell_complete Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands.
Method to_info_dict Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command.
Class Variable allow_extra_args Undocumented
Class Variable allow_interspersed_args Undocumented
Instance Variable chain Undocumented
Instance Variable invoke_without_command Undocumented
Instance Variable no_args_is_help Undocumented
Instance Variable subcommand_metavar Undocumented
Instance Variable _result_callback Undocumented

Inherited from Command:

Method format_epilog Writes the epilog into the formatter if it exists.
Method format_help Writes the help into the formatter if it exists.
Method format_help_text Writes the help text to the formatter if it exists.
Method format_usage Writes the usage line into the formatter.
Method get_help Formats the help into a string and returns it.
Method get_help_option Returns the help option object.
Method get_help_option_names Returns the names for the help option.
Method get_params Undocumented
Method get_short_help_str Gets short help for the command or makes it by shortening the long help string.
Method get_usage Formats the usage line into a string and returns it.
Method make_parser Creates the underlying option parser for this command.
Instance Variable add_help_option Undocumented
Instance Variable callback Undocumented
Instance Variable deprecated Undocumented
Instance Variable epilog Undocumented
Instance Variable help Undocumented
Instance Variable hidden Undocumented
Instance Variable options_metavar Undocumented
Instance Variable params Undocumented
Instance Variable short_help Undocumented

Inherited from BaseCommand (via Command):

Method __call__ Alias for :meth:`main`.
Method __repr__ Undocumented
Method main This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``SystemExit`` needs to be caught.
Method make_context This function when given an info name and arguments will kick off the parsing and create a new :class:`Context`. It does not invoke the actual command callback though.
Class Variable ignore_unknown_options Undocumented
Instance Variable context_settings Undocumented
Instance Variable name Undocumented
Method _main_shell_completion Check if the shell is asking for tab completion, process that, then exit early. Called from :meth:`main` before the program is invoked.
def __init__(self, name=None, invoke_without_command=False, no_args_is_help=None, subcommand_metavar=None, chain=False, result_callback=None, **attrs): (source)

Undocumented

Parameters
name:t.Optional[str]Undocumented
invoke_without_command:boolUndocumented
no_args_is_help:t.Optional[bool]Undocumented
subcommand_metavar:t.Optional[str]Undocumented
chain:boolUndocumented
result_callback:t.Optional[t.Callable[..., t.Any]]Undocumented
**attrs:t.AnyUndocumented
def collect_usage_pieces(self, ctx): (source)

Returns all the pieces that go into the usage line and returns it as a list of strings.

Parameters
ctx:ContextUndocumented
Returns
t.List[str]Undocumented
def format_commands(self, ctx, formatter): (source)

Extra format methods for multi methods that adds all the commands after the options.

Parameters
ctx:ContextUndocumented
formatter:HelpFormatterUndocumented
def format_options(self, ctx, formatter): (source)

Writes all the options into the formatter if they exist.

Parameters
ctx:ContextUndocumented
formatter:HelpFormatterUndocumented
def get_command(self, ctx, cmd_name): (source)

Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`.

Parameters
ctx:ContextUndocumented
cmd_name:strUndocumented
Returns
t.Optional[Command]Undocumented
def invoke(self, ctx): (source)

Given a context, this invokes the attached callback (if it exists) in the right way.

Parameters
ctx:ContextUndocumented
Returns
t.AnyUndocumented
def list_commands(self, ctx): (source)

Returns a list of subcommand names in the order they should appear.

Parameters
ctx:ContextUndocumented
Returns
t.List[str]Undocumented
def parse_args(self, ctx, args): (source)

Given a context and a list of arguments this creates the parser and parses the arguments, then modifies the context as necessary. This is automatically invoked by :meth:`make_context`.

Parameters
ctx:ContextUndocumented
args:t.List[str]Undocumented
Returns
t.List[str]Undocumented
def resolve_command(self, ctx, args): (source)

Undocumented

Parameters
ctx:ContextUndocumented
args:t.List[str]Undocumented
Returns
t.Tuple[t.Optional[str], t.Optional[Command], t.List[str]]Undocumented
def result_callback(self, replace=False): (source)

Adds a result callback to the command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcommand (or the list of return values from all subcommands if chaining is enabled) as well as the parameters as they would be passed to the main callback. Example:: @click.group() @click.option('-i', '--input', default=23) def cli(input): return 42 @cli.result_callback() def process_result(result, input): return result + input :param replace: if set to `True` an already existing result callback will be removed. .. versionchanged:: 8.0 Renamed from ``resultcallback``. .. versionadded:: 3.0

Parameters
replace:boolUndocumented
Returns
t.Callable[[F], F]Undocumented
def shell_complete(self, ctx, incomplete): (source)

Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands. :param ctx: Invocation context for this command. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0

Parameters
ctx:ContextUndocumented
incomplete:strUndocumented
Returns
t.List[CompletionItem]Undocumented
def to_info_dict(self, ctx): (source)

Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. :param ctx: A :class:`Context` representing this command. .. versionadded:: 8.0

Parameters
ctx:ContextUndocumented
Returns
t.Dict[str, t.Any]Undocumented
allow_extra_args: bool = (source)
allow_interspersed_args: bool = (source)
chain = (source)

Undocumented

invoke_without_command = (source)

Undocumented

no_args_is_help = (source)

Undocumented

subcommand_metavar = (source)

Undocumented

_result_callback = (source)

Undocumented