class Group(MultiCommand): (source)
A group allows a command to have subcommands attached. This is the most common way to implement nesting in Click. :param name: The name of the group command. :param commands: A dict mapping names to :class:`Command` objects. Can also be a list of :class:`Command`, which will use :attr:`Command.name` to create the dict. :param attrs: Other command arguments described in :class:`MultiCommand`, :class:`Command`, and :class:`BaseCommand`. .. versionchanged:: 8.0 The ``commmands`` argument can be a list of command objects.
Method | __init__ |
Undocumented |
Method | add |
Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used. |
Method | command |
A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as :func:`command` and immediately registers the created command with this group by calling :meth:`add_command`. |
Method | get |
Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`. |
Method | group |
A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` and immediately registers the created group with this group by calling :meth:`add_command`. |
Method | list |
Returns a list of subcommand names in the order they should appear. |
Class Variable | command |
Undocumented |
Class Variable | group |
Undocumented |
Instance Variable | commands |
Undocumented |
Inherited from MultiCommand
:
Method | collect |
Returns all the pieces that go into the usage line and returns it as a list of strings. |
Method | format |
Extra format methods for multi methods that adds all the commands after the options. |
Method | format |
Writes all the options into the formatter if they exist. |
Method | invoke |
Given a context, this invokes the attached callback (if it exists) in the right way. |
Method | parse |
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 |
Undocumented |
Method | result |
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 |
Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands. |
Method | to |
Gather information that could be useful for a tool generating user-facing documentation. This traverses the entire structure below this command. |
Class Variable | allow |
Undocumented |
Class Variable | allow |
Undocumented |
Instance Variable | chain |
Undocumented |
Instance Variable | invoke |
Undocumented |
Instance Variable | no |
Undocumented |
Instance Variable | subcommand |
Undocumented |
Instance Variable | _result |
Undocumented |
Inherited from Command
(via MultiCommand
):
Method | format |
Writes the epilog into the formatter if it exists. |
Method | format |
Writes the help into the formatter if it exists. |
Method | format |
Writes the help text to the formatter if it exists. |
Method | format |
Writes the usage line into the formatter. |
Method | get |
Formats the help into a string and returns it. |
Method | get |
Returns the help option object. |
Method | get |
Returns the names for the help option. |
Method | get |
Undocumented |
Method | get |
Gets short help for the command or makes it by shortening the long help string. |
Method | get |
Formats the usage line into a string and returns it. |
Method | make |
Creates the underlying option parser for this command. |
Instance Variable | add |
Undocumented |
Instance Variable | callback |
Undocumented |
Instance Variable | deprecated |
Undocumented |
Instance Variable | epilog |
Undocumented |
Instance Variable | help |
Undocumented |
Instance Variable | hidden |
Undocumented |
Instance Variable | options |
Undocumented |
Instance Variable | params |
Undocumented |
Instance Variable | short |
Undocumented |
Inherited from BaseCommand
(via MultiCommand
, 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 |
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 |
Undocumented |
Instance Variable | context |
Undocumented |
Instance Variable | name |
Undocumented |
Method | _main |
Check if the shell is asking for tab completion, process that, then exit early. Called from :meth:`main` before the program is invoked. |
click.core.MultiCommand.__init__
Undocumented
Parameters | |
name:t.Optional[ | Undocumented |
commands:t.Optional[ | Undocumented |
**attrs:t.Any | Undocumented |
Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used.
Parameters | |
cmd:Command | Undocumented |
name:t.Optional[ | Undocumented |
A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as :func:`command` and immediately registers the created command with this group by calling :meth:`add_command`. To customize the command class used, set the :attr:`command_class` attribute. .. versionchanged:: 8.1 This decorator can be applied without parentheses. .. versionchanged:: 8.0 Added the :attr:`command_class` attribute.
Parameters | |
*args:t.Any | Undocumented |
**kwargs:t.Any | Undocumented |
Returns | |
t.Union[ | Undocumented |
click.core.MultiCommand.get_command
Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`.
Parameters | |
ctx:Context | Undocumented |
cmdstr | Undocumented |
Returns | |
t.Optional[ | Undocumented |
A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` and immediately registers the created group with this group by calling :meth:`add_command`. To customize the group class used, set the :attr:`group_class` attribute. .. versionchanged:: 8.1 This decorator can be applied without parentheses. .. versionchanged:: 8.0 Added the :attr:`group_class` attribute.
Parameters | |
*args:t.Any | Undocumented |
**kwargs:t.Any | Undocumented |
Returns | |
t.Union[ | Undocumented |