:orphan: :mod:`cloup._commands` ====================== .. py:module:: cloup._commands Classes summary --------------- .. autosummary:: ~cloup._commands.Command ~cloup._commands.MultiCommand ~cloup._commands.Group Functions Summary ----------------- .. autosummary:: ~cloup._commands.group ~cloup._commands.command Contents -------- .. class:: Command(*click_args, constraints = (), show_constraints = False, align_option_groups = True, **click_kwargs) Bases: :py:obj:`cloup.constraints.ConstraintMixin`, :py:obj:`cloup._option_groups.OptionGroupMixin`, :py:obj:`click.Command` A ``click.Command`` supporting option groups and constraints. .. class:: MultiCommand(*args, commands = None, sections = (), align_sections = True, **kwargs) Bases: :py:obj:`cloup._sections.SectionMixin`, :py:obj:`click.MultiCommand` A ``click.MultiCommand`` that allows to organize its subcommands in multiple help sections and and whose subcommands are, by default, of type :class:`cloup.Command`. This class is just a :class:`click.MultiCommand` mixed with :class:`SectionMixin`. See the docstring of the two superclasses for more details. .. class:: Group(name = None, commands = None, sections = (), align_sections = True, **attrs) Bases: :py:obj:`cloup._sections.SectionMixin`, :py:obj:`click.Group` A ``click.Group`` that allows to organize its subcommands in multiple help sections and and whose subcommands are, by default, of type :class:`cloup.Command`. This class is just a :class:`click.Group` mixed with :class:`SectionMixin` that overrides the decorators :meth:`command` and :meth:`group` so that a ``section`` for the created subcommand can be specified. See the docstring of the two superclasses for more details. .. method:: command(self, name = None, cls = None, section = None, **kwargs) Creates a new command and adds it to this group. .. method:: group(self, name = None, cls = None, section = None, **kwargs) A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` but immediately registers the created command with this instance by calling into :meth:`add_command`. .. function:: group(name = None, cls = Group, **attrs) Decorator for creating a new :class:`Group`. .. note:: If you use static type checking, note that the ``cls`` optional argument of this function must be of type ``cloup.Group``, not ``click.Group``. :param name: name of the command :param cls: type of ``cloup.Group`` :param attrs: any argument you can pass to :func:`click.group` .. function:: command(name = None, cls = Command, **attrs) Decorator that creates a new command using the wrapped function as callback. The only differences with respect to ``click.commands`` are: - this decorator creates a ``cloup.Command`` by default; - this decorator supports ``@constraint``. :param name: name of the command :param cls: type of click.Command :param attrs: any argument you can pass to :func:`click.command`