Grouping command options#

In cases when a command has many options, it can be useful to divide these options into different sections which are displayed on the command help page. For instance, basic and advanced options.

The section() decorator can be used to define these sections for a command.

See also

Group.__sections__() can be used to similarly partition commands and subgroups displayed on a Group help page.


API reference#

feud.decorators.section(**options)#

Partition command options into sections.

These sections are displayed on the group help page if rich-click is installed.

Parameters:

**options (str) – Mapping of option names to section names. Option names must be keyword-only parameters in the decorated function signature.

Return type:

Function decorated with section metadata.

Examples

>>> import feud
>>> @feud.section(
...     opt1="Basic options",
...     opt2="Advanced options",
...     opt3="Basic options",
... )
... def my_func(arg1: int, *, opt1: str, opt2: bool, opt3: float):
...     pass