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

Indicate multiple use options in help #2778

Open
ofek opened this issue Sep 18, 2024 · 1 comment
Open

Indicate multiple use options in help #2778

ofek opened this issue Sep 18, 2024 · 1 comment

Comments

@ofek
Copy link
Contributor

ofek commented Sep 18, 2024

I think it would be nice to append a ... to the metavar when multiple is true. Using curl as an example, -H TEXT would become -H TEXT....

@swills1
Copy link

swills1 commented Nov 30, 2024

Can you please explain your overall reasoning? Maybe I am misunderstanding, but couldn't you do this -


@click.command()
@click.option('--color', multiple=True, metavar='<COLOR>', help='Specify a color')
@click.option('--size', multiple=True, metavar='<SIZE>', help='Specify a size')
def cli(color, size):
    click.echo(f'You selected the colors: {", ".join(color)}')
    click.echo(f'You selected the sizes: {", ".join(size)}')

if __name__ == '__main__':
    cli()

Then you would get -

$ python script.py --color red --color green --color blue --size small --size large
You selected the colors: red, green, blue
You selected the sizes: small, large

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