:orphan: :mod:`cloup._option_groups` =========================== .. py:module:: cloup._option_groups .. autoapi-nested-parse:: Implements support to option group. Classes summary --------------- .. autosummary:: ~cloup._option_groups.OptionGroup ~cloup._option_groups.GroupedOption ~cloup._option_groups.OptionGroupMixin Functions Summary ----------------- .. autosummary:: ~cloup._option_groups.has_option_group ~cloup._option_groups.get_option_group_of ~cloup._option_groups.option ~cloup._option_groups.option_group Contents -------- .. data:: C .. data:: OptionDecorator .. data:: OptionGroupDecorator .. class:: OptionGroup(name, help = None, constraint = None) .. method:: get_help_records(self, ctx) .. method:: option(self, *param_decls, **attrs) .. method:: __iter__(self) .. method:: __getitem__(self, i) .. method:: __len__(self) .. method:: __repr__(self) Return repr(self). .. method:: __str__(self) Return str(self). .. class:: GroupedOption(*args, group = None, **attrs) Bases: :py:obj:`click.Option` A click.Option with an extra field ``group`` of type OptionGroup .. function:: has_option_group(param) .. function:: get_option_group_of(param, default=None) .. class:: OptionGroupMixin(*args, align_option_groups = True, **kwargs) Implements support to option groups. .. versionadded:: 0.5.0 .. important:: In order to check the constraints defined on the option groups, a command must inherits from :class:`cloup.ConstraintMixin` too! .. method:: get_ungrouped_options(self, ctx) .. method:: get_option_group_title(self, ctx, opt_group) .. method:: format_option_group(self, ctx, formatter, opt_group, help_records = None) .. method:: format_options(self, ctx, formatter, max_option_width = 30) .. function:: option(*param_decls, group = None, cls = GroupedOption, **attrs) .. function:: option_group(name: str, help: str, *options: OptionDecorator, constraint: Optional[cloup.constraints.Constraint] = None) -> OptionGroupDecorator option_group(name: str, *options: OptionDecorator, help: Optional[str] = None, constraint: Optional[cloup.constraints.Constraint] = None) -> OptionGroupDecorator Attaches an option group to the command. This decorator is overloaded with two signatures:: @option_group(name: str, *options, help: Optional[str] = None) @option_group(name: str, help: str, *options) In other words, if the second position argument is a string, it is interpreted as the "help" argument. Otherwise, it is interpreted as the first option; in this case, you can still pass the help as keyword argument. :param name: a mandatory name/title for the group :param help: an optional help string for the group :param options: option decorators like `click.option` :param constraint: a ``Constraint`` to validate on this option group :return: a decorator that attaches the contained options to the decorated function