Christopher Tyler

Passing a List of Arguments with Click

You can use the multiple option.

1
2
3
4
5
6
7
8
@click.command()
@click.option('--message', '-m', multiple=True)
def commit(message):
click.echo('\n'.join(message))

$ commit -m foo -m bar
foo
bar

More info, see https://click.palletsprojects.com/en/8.1.x/options/#multiple-options

<< Previous Post

|

Next Post >>

#Click #Python