Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
click.core.Group Class Reference
Inheritance diagram for click.core.Group:
Inheritance graph
[legend]
Collaboration diagram for click.core.Group:
Collaboration graph
[legend]

Public Member Functions

None __init__ (self, str|None name=None, cabc.MutableMapping[str, Command]|cabc.Sequence[Command]|None commands=None, bool invoke_without_command=False, bool|None no_args_is_help=None, str|None subcommand_metavar=None, bool chain=False, t.Callable[..., t.Any]|None result_callback=None, **t.Any kwargs)
 
dict[str, t.Any] to_info_dict (self, Context ctx)
 
None add_command (self, Command cmd, str|None name=None)
 
Command command (self, t.Callable[..., t.Any] __func)
 
t.Callable[[t.Callable[..., t.Any]], Commandcommand (self, *t.Any args, **t.Any kwargs)
 
t.Callable[[t.Callable[..., t.Any]], Command]|Command command (self, *t.Any args, **t.Any kwargs)
 
Group group (self, t.Callable[..., t.Any] __func)
 
t.Callable[[t.Callable[..., t.Any]], Groupgroup (self, *t.Any args, **t.Any kwargs)
 
t.Callable[[t.Callable[..., t.Any]], Group]|Group group (self, *t.Any args, **t.Any kwargs)
 
t.Callable[[F], F] result_callback (self, bool replace=False)
 
Command|None get_command (self, Context ctx, str cmd_name)
 
list[str] list_commands (self, Context ctx)
 
list[str] collect_usage_pieces (self, Context ctx)
 
None format_options (self, Context ctx, HelpFormatter formatter)
 
None format_commands (self, Context ctx, HelpFormatter formatter)
 
list[str] parse_args (self, Context ctx, list[str] args)
 
t.Any invoke (self, Context ctx)
 
tuple[str|None, Command|None, list[str]] resolve_command (self, Context ctx, list[str] args)
 
list[CompletionItemshell_complete (self, Context ctx, str incomplete)
 
- Public Member Functions inherited from click.core.Command
str __repr__ (self)
 
str get_usage (self, Context ctx)
 
list[Parameterget_params (self, Context ctx)
 
None format_usage (self, Context ctx, HelpFormatter formatter)
 
list[str] get_help_option_names (self, Context ctx)
 
Option|None get_help_option (self, Context ctx)
 
_OptionParser make_parser (self, Context ctx)
 
str get_help (self, Context ctx)
 
str get_short_help_str (self, int limit=45)
 
None format_help (self, Context ctx, HelpFormatter formatter)
 
None format_help_text (self, Context ctx, HelpFormatter formatter)
 
None format_epilog (self, Context ctx, HelpFormatter formatter)
 
Context make_context (self, str|None info_name, list[str] args, Context|None parent=None, **t.Any extra)
 
t.NoReturn main (self, cabc.Sequence[str]|None args=None, str|None prog_name=None, str|None complete_var=None, t.Literal[True] standalone_mode=True, **t.Any extra)
 
t.Any main (self, cabc.Sequence[str]|None args=None, str|None prog_name=None, str|None complete_var=None, bool standalone_mode=..., **t.Any extra)
 
t.Any main (self, cabc.Sequence[str]|None args=None, str|None prog_name=None, str|None complete_var=None, bool standalone_mode=True, bool windows_expand_args=True, **t.Any extra)
 
t.Any __call__ (self, *t.Any args, **t.Any kwargs)
 

Public Attributes

 no_args_is_help
 
 invoke_without_command
 
 subcommand_metavar
 
 chain
 
 commands
 
- Public Attributes inherited from click.core.Command
 name
 
 callback
 
 help
 
 epilog
 
 options_metavar
 
 short_help
 
 add_help_option
 
 no_args_is_help
 
 hidden
 
 deprecated
 

Static Public Attributes

bool allow_extra_args = True
 
bool allow_interspersed_args = False
 
type command_class = None
 
type group_class = None
 
- Static Public Attributes inherited from click.core.Command
type context_class = Context
 
bool allow_extra_args = False
 
bool allow_interspersed_args = True
 
bool ignore_unknown_options = False
 

Protected Attributes

 _result_callback
 
- Protected Attributes inherited from click.core.Command
 _help_option
 

Additional Inherited Members

- Protected Member Functions inherited from click.core.Command
None _main_shell_completion (self, cabc.MutableMapping[str, t.Any] ctx_args, str prog_name, str|None complete_var=None)
 

Detailed Description

A group is a command that nests other commands (or more groups).

:param name: The name of the group command.
:param commands: Map names to :class:`Command` objects. Can be a list, which
    will use :attr:`Command.name` as the keys.
:param invoke_without_command: Invoke the group's callback even if a
    subcommand is not given.
:param no_args_is_help: If no arguments are given, show the group's help and
    exit. Defaults to the opposite of ``invoke_without_command``.
:param subcommand_metavar: How to represent the subcommand argument in help.
    The default will represent whether ``chain`` is set or not.
:param chain: Allow passing more than one subcommand argument. After parsing
    a command's arguments, if any arguments remain another command will be
    matched, and so on.
:param result_callback: A function to call after the group's and
    subcommand's callbacks. The value returned by the subcommand is passed.
    If ``chain`` is enabled, the value will be a list of values returned by
    all the commands. If ``invoke_without_command`` is enabled, the value
    will be the value returned by the group's callback, or an empty list if
    ``chain`` is enabled.
:param kwargs: Other arguments passed to :class:`Command`.

.. versionchanged:: 8.0
    The ``commands`` argument can be a list of command objects.

.. versionchanged:: 8.2
    Merged with and replaces the ``MultiCommand`` base class.

Constructor & Destructor Documentation

◆ __init__()

None click.core.Group.__init__ (   self,
str | None   name = None,
cabc.MutableMapping[str, Command] | cabc.Sequence[Command] | None   commands = None,
bool   invoke_without_command = False,
bool | None   no_args_is_help = None,
str | None   subcommand_metavar = None,
bool   chain = False,
t.Callable[..., t.Any] | None   result_callback = None,
**t.Any  kwargs 
)

Reimplemented from click.core.Command.

Member Function Documentation

◆ add_command()

None click.core.Group.add_command (   self,
Command  cmd,
str | None   name = None 
)
Registers another :class:`Command` with this group.  If the name
is not provided, the name of the command is used.

◆ collect_usage_pieces()

list[str] click.core.Group.collect_usage_pieces (   self,
Context  ctx 
)
Returns all the pieces that go into the usage line and returns
it as a list of strings.

Reimplemented from click.core.Command.

◆ command()

t.Callable[[t.Callable[..., t.Any]], Command] | Command click.core.Group.command (   self,
*t.Any  args,
**t.Any   kwargs 
)
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.

◆ format_commands()

None click.core.Group.format_commands (   self,
Context  ctx,
HelpFormatter  formatter 
)
Extra format methods for multi methods that adds all the commands
after the options.

Reimplemented in click_default_group.DefaultGroup.

◆ format_options()

None click.core.Group.format_options (   self,
Context  ctx,
HelpFormatter  formatter 
)
Writes all the options into the formatter if they exist.

Reimplemented from click.core.Command.

◆ get_command()

Command | None click.core.Group.get_command (   self,
Context  ctx,
str  cmd_name 
)
Given a context and a command name, this returns a :class:`Command`
object if it exists or returns ``None``.

Reimplemented in click.core.CommandCollection, and click_default_group.DefaultGroup.

◆ group()

t.Callable[[t.Callable[..., t.Any]], Group] | Group click.core.Group.group (   self,
*t.Any  args,
**t.Any   kwargs 
)
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.

◆ invoke()

t.Any click.core.Group.invoke (   self,
Context  ctx 
)
Given a context, this invokes the attached callback (if it exists)
in the right way.

Reimplemented from click.core.Command.

◆ list_commands()

list[str] click.core.Group.list_commands (   self,
Context  ctx 
)
Returns a list of subcommand names in the order they should appear.

Reimplemented in click.core.CommandCollection.

◆ parse_args()

list[str] click.core.Group.parse_args (   self,
Context  ctx,
list[str]  args 
)

Reimplemented from click.core.Command.

◆ result_callback()

t.Callable[[F], F] click.core.Group.result_callback (   self,
bool   replace = False 
)
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

◆ shell_complete()

list[CompletionItem] click.core.Group.shell_complete (   self,
Context  ctx,
str  incomplete 
)
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

Reimplemented from click.core.Command.

◆ to_info_dict()

dict[str, t.Any] click.core.Group.to_info_dict (   self,
Context  ctx 
)

Reimplemented from click.core.Command.


The documentation for this class was generated from the following file: