:orphan: :mod:`cloup._sections` ====================== .. py:module:: cloup._sections Classes summary --------------- .. autosummary:: ~cloup._sections.Section ~cloup._sections.SectionMixin Contents -------- .. data:: CommandType .. data:: Subcommands .. class:: Section(title, commands = (), sorted = False) A group of (sub)commands to show in the same help section of a ``MultiCommand``. You can use sections with any `Command` that inherits from :class:`SectionMixin`. .. versionchanged:: 0.6.0 Removed the deprecated old name ``GroupSection``. .. versionchanged:: 0.5.0 Introduced the new name ``Section`` and deprecated the old ``GroupSection``. .. method:: sorted(cls, title, commands = ()) :classmethod: .. method:: add_command(self, cmd, name = None) .. method:: list_commands(self) .. method:: __len__(self) .. method:: __repr__(self) Return repr(self). .. class:: SectionMixin(*args, commands = None, sections = (), align_sections = True, **kwargs) Adds to a click.MultiCommand the possibility to organize its subcommands in multiple help sections. Sections can be specified in the following ways: #. passing a list of :class:`Section` objects to the constructor setting the argument ``sections`` #. using :meth:`add_section` to add a single section #. using :meth:`add_command` with the argument `section` set Commands not assigned to any user-defined section are added to the "default section", whose title is "Commands" or "Other commands" depending on whether it is the only section or not. The default section is the last shown section in the help and its commands are listed in lexicographic order. .. versionadded:: 0.5.0 .. method:: add_section(self, section) Adds a :class:`Section` to this group. You can add the same section object a single time. .. method:: section(self, title, *commands, **attrs) Creates a new :class:`Section`, adds it to this group and returns it. .. method:: add_command(self, cmd, name = None, section = None) Adds a new command. If ``section`` is None, the command is added to the default section. .. method:: list_sections(self, ctx, include_default_section = True) Returns the list of all sections in the "correct order". if ``include_default_section=True`` and the default section is non-empty, it will be included at the end of the list. .. method:: format_commands(self, ctx, formatter) .. method:: format_section(self, ctx, formatter, section, command_col_width = None)