click
click copied to clipboard
Indicate multiple use options in help
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....
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