Skip to content
Myr

Documented alternative prefix chars

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 38b3b41 · Browse files · 1 file+26 added−0 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+26 added−0 removed

  • other:+26 added−0 removed

1 file+26 added−0 removed

modified:docs/options.rst+26 added
416 unmodified lines
417 invoke(greet, env={'USERNAME': 'john'})418419In that case it can also be a list of different environment variables420where the first one is picked.421422Other Prefix Characters423-----------------------424425Click can deal with alternative prefix characters, other than ``-`` for426options. This is for instance useful if you want to handle slashes as427parameters ``/`` or something similar. Note that this is strongly428discouraged in general because click wants developers to stay close to429POSIX semantics. However in certain situations this can be useful:430431.. click:example::432433 @click.command()434 @click.option('+w/-w')435 def chmod(w):436 click.echo('writable=%s' % w)437438 if __name__ == '__main__':439 chmod()440441And from the command line:442443.. click:run::444445 invoke(chmod, args=['+w'])446 invoke(chmod, args=['-w'])