Skip to content
Myr

Correct errors in docs for multiple options.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Edward G · committed by Edward G · parent 6a1c0d0 · Browse files · 1 file+5 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:docs/options.md+5 added-3 removed
129 unmodified lines
130```131132## Multi Value Options133134To make an option take multiple values, pass in `nargs`. Note only a fixed number of arguments is supported. The values are passed to the underlying function as a tuple.134To make an option take multiple values, pass in `nargs`. Note you may pass in any positive integer, but not -1. The values are passed to the underlying function as a tuple.135136```{eval-rst}137.. click:example::138
55 unmodified lines
194(multiple-options)=195196## Multiple Options197198The multiple options format allows you to call the underlying function multiple times with one command line entry. If set, the default must be a list or tuple. Setting a string as a default will be interpreted as list of characters.198The multiple options format allows options to take an arbitrary number of arguments (which is called variadic). The arguments are passed to the underlying function as a tuple. If set, the default must be a list or tuple. Setting a string as a default will be interpreted as list of characters.199200```{eval-rst}201.. click:example::202203 @click.command()204 @click.option('--message', '-m', multiple=True)205 def commit(message):206 click.echo('\n'.join(message))206 click.echo(message)207 for m in message:208 click.echo(m)209210.. click:run::211212 invoke(commit, args=['-m', 'foo', '-m', 'bar', '-m', 'here'])
287 unmodified lines