Skip to content

Allow showing default values globally. #1018

@mchwalisz

Description

@mchwalisz

Feature request, as in #646, we already had a discussion how to easily show default values for options. As context_settings is already used to configure global settings anyway, the idea would be to allow the following:

@click.command(
    help='Command helptext',
    context_settings=dict(show_default=True))
@click.option("--test", default="foobar", help="Option helptext")
def cli(test):
    pass

Which should enable show_default for all options and give the following help text:

$ cli --help
Usage: cli [OPTIONS]

  Command helptext

Options:
  --test TEXT   Option helptext. Default: 'foobar'
  --help        Show this message and exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions