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

Too developer centric help output #2667

Open
aptly-io opened this issue Jan 23, 2024 · 1 comment
Open

Too developer centric help output #2667

aptly-io opened this issue Jan 23, 2024 · 1 comment

Comments

@aptly-io
Copy link

import click, sys
from typing import TextIO

@click.command()
@click.option("--name", type=click.File("r"), default=sys.stdin, show_default=True)
def hello(name: TextIO):
    click.echo('Hello World!')

if __name__ == '__main__':
    hello()

Results in this help output:

$ python main.py hello --help
Usage: main.py [OPTIONS]

Options:
  --name FILENAME  [default: <_io.TextIOWrapper name='<stdin>' mode='r'
                   encoding='utf-8'>]
  --help           Show this message and exit.

Describe the expected behavior that should have happened but didn't.

$ python main.py hello --help
Usage: main.py [OPTIONS]

Options:
  --name FILENAME  [default: stdin]
  --help           Show this message and exit.

Environment:

  • Python version: 3.11.3
  • Click version: 8.1.7
@asottile-sentry
Copy link

I think you've misread the docs for show_default and you actually want show_default='stdin'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants