koapy.cli.extensions.verbose_option

Module Contents

Classes

VerboseOption

Options are usually optional values on the command line and

Functions

verbose_flag_option([default, flag_value, ...])

no_verbose_flag_option([help])

verbose_option([dest, default, flag_value, callback, ...])

class koapy.cli.extensions.verbose_option.VerboseOption(*decls, **attrs)[source]

Bases: click.Option

Options are usually optional values on the command line and have some extra features that arguments don’t have.

All other parameters are passed onwards to the parameter constructor.

Parameters:
  • show_default – Show the default value for this option in its help text. Values are not shown by default, unless Context.show_default is True. If this value is a string, it shows that string in parentheses instead of the actual value. This is particularly useful for dynamic options. For single option boolean flags, the default remains hidden if its value is False.

  • show_envvar – Controls if an environment variable should be shown on the help page. Normally, environment variables are not shown.

  • prompt – If set to True or a non empty string then the user will be prompted for input. If set to True the prompt will be the option name capitalized.

  • confirmation_prompt – Prompt a second time to confirm the value if it was prompted for. Can be set to a string instead of True to customize the message.

  • prompt_required – If set to False, the user will be prompted for input only when the option was specified as a flag without a value.

  • hide_input – If this is True then the input on the prompt will be hidden from the user. This is useful for password input.

  • is_flag – forces this option to act as a flag. The default is auto detection.

  • flag_value – which value should be used for this flag if it’s enabled. This is set to a boolean automatically if the option string contains a slash to mark two options.

  • multiple – if this is set to True then the argument is accepted multiple times and recorded. This is similar to nargs in how it works but supports arbitrary number of arguments.

  • count – this flag makes an option increment an integer.

  • allow_from_autoenv – if this is enabled then the value of this parameter will be pulled from an environment variable in case a prefix is defined on the context.

  • help – the help string.

  • hidden – hide this option from help outputs.

Changed in version 8.1.0: Help text indentation is cleaned here instead of only in the @option decorator.

Changed in version 8.1.0: The show_default parameter overrides Context.show_default.

Changed in version 8.1.0: The default of a single option boolean flag is not shown if the default value is False.

Changed in version 8.0.1: type is detected from flag_value if given.

add_to_parser(parser, ctx)[source]
koapy.cli.extensions.verbose_option.verbose_flag_option(default=0, flag_value=1, show_default=False, metavar='[0...5]', help='Set verbosity level.')[source]
koapy.cli.extensions.verbose_option.no_verbose_flag_option(help='Force zero verbosity.')[source]
koapy.cli.extensions.verbose_option.verbose_option(dest='verbose', default=0, flag_value=1, callback=None, expose_value=False, show_default=False)[source]