Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty default value in --help output for option with multiple=True #1969

Closed
pbeza opened this issue Jun 22, 2021 · 0 comments · Fixed by #1970
Closed

Empty default value in --help output for option with multiple=True #1969

pbeza opened this issue Jun 22, 2021 · 0 comments · Fixed by #1970
Milestone

Comments

@pbeza
Copy link

pbeza commented Jun 22, 2021

Minimal reproducible example that demonstrates the bug

#!/usr/bin/env python3

import click

@click.command()
@click.option('--multioption', multiple=True, default=None, help='My help', show_default=True)
def info(_multioption):
    pass


if __name__ == '__main__':
    info()

Notice multiple=True which is crucial. If you replace it with multiple=False it will work just fine.

What I get

$ ./test.py --help
Usage: test.py [OPTIONS]

Options:
  --multioption TEXT  My help  [default: ]
  --help              Show this message and exit.  [default: False]

Expected output

$ ./test.py --help
Usage: test.py [OPTIONS]

Options:
  --multioption TEXT  My help
  --help              Show this message and exit.  [default: False]

Environment

Python version

$ python3 --version
Python 3.9.2

Click version

$ python -c "import click; print(click.__version__)"
8.0.1

(I checked that 8.0.2.dev0 is also affected)

pbeza added a commit to pbeza/click that referenced this issue Jun 22, 2021
pbeza added a commit to pbeza/click that referenced this issue Jun 22, 2021
@davidism davidism added this to the 8.0.2 milestone Jul 4, 2021
@davidism davidism closed this as completed Jul 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants