Skip to content

Improvement for show_default showing in case of a flag the name instead of True/False #1538

@Nachtfeuer

Description

@Nachtfeuer

First to say: It's not a bug ... it's (in my opinion) a reasonable improvement.

Expected Behavior

That's how the boolean flag is configured:

@click.option('--cache/--no-cache', default=False, show_default=True,
              help="Enable/Diable the cache.")

Using the --help you see following (just the line of interest):

--cache / --no-cache        Enable/Diable the cache.  [default: False]

but preferable woud be:

--cache / --no-cache        Enable/Diable the cache.  [default: no-cache]

It's clear to me that this works for --cache/--no-cache like flags only.

Actual Behavior

The output is as documented by the API the default value (not the name) which is for a boolean True or False.

Environment

  • Python version: 3.8.1
  • Click version: 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    f:helpfeature: help text

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions