8000 `show_choices=False` seems to have no effect · Issue #2356 · pallets/click · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
show_choices=False seems to have no effect #2356
Closed
@zmoon

Description

@zmoon

I noticed when using Typer that even if you pass show_choices=False, the choices still get shown in the help. It seems that this is related to Click.

Example:

import click

@click.command()
@click.option('-s', '--string-to-echo', type=click.Choice(['hello', 'world']), show_choices=False)
def echo(string):
    click.echo(string)

if __name__ == "__main__":
    echo()
Usage: ... [OPTIONS]

Options:
  -s, --string-to-echo [hello|world]
  --help                          Show this message and exit.

I guess it isn't documented what show_choices does for Option (if anything) in the non-prompt case, but I expected show_choices=False to disable showing the choices in the help.

Environment:

  • Python version: 3.9.13
  • Click version: 8.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0