Skip to content
Myr

Merge pull request #1157 from theazureshadow/clarify-multiple-options

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

Clarify multiple options

authored by David Lord · committed by GitHub · parents f546f06, 2efe22f · Browse files · 4 files+10 added−7 removed
This commit

State

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

Diff stats

4 files+10 added−7 removed

  • other:+10 added−7 removed

4 files+10 added−7 removed

modified:docs/bashcomplete.rst+4 added-4 removed
16 unmodified lines
1718What it Completes19-----------------2021Generally, the Bash completion support will complete subcommands, options22and any option or argument values where the type is click.Choice.23Subcommands and choices are always listed whereas options only if at24least a dash has been provided. Example::21Generally, the Bash completion support will complete subcommands,22options, and any option or argument values where the type is23:class:`click.Choice`. Subcommands and choices are always listed whereas24options are only listed if at least a dash has been provided. ::2526 $ repo <TAB><TAB>27 clone commit copy delete setuser28 $ repo clone -<TAB><TAB>
103 unmodified lines
modified:docs/options.rst+2 added
143 unmodified lines
144 @click.option('--item', nargs=2, type=click.Tuple([str, int]))145 def putitem(item):146 click.echo('name=%s id=%d' % item)147148.. _multiple-options:149150Multiple Options151----------------152153Similarly to ``nargs``, there is also the case of wanting to support a
675 unmodified lines
modified:docs/parameters.rst+2 added-1 removed
26 unmodified lines
27 might be too specific to be automatically documented)2829On the other hand arguments, unlike options, can accept an arbitrary number30of arguments. Options can strictly ever only accept a fixed number of31arguments (defaults to 1).31arguments (defaults to 1), or they may be specified multiple times using32:ref:`multiple-options`.3334Parameter Types35---------------36
114 unmodified lines
modified:docs/utils.rst+2 added-2 removed
31 unmodified lines
3233Last but not least :func:`echo` uses click's intelligent internal output34streams to stdout and stderr which support unicode output on the Windows35console. This means for as long as you are using `click.echo` you can36output unicode character (there are some limitations on the default font36output unicode characters (there are some limitations on the default font37with regards to which characters can be displayed). This functionality is38new in Click 6.0.3940.. versionadded:: 6.0
169 unmodified lines
210Click supports launching editors automatically through :func:`edit`. This211is very useful for asking users for multi-line input. It will212automatically open the user's defined editor or fall back to a sensible213default. If the user closes the editor without saving, the return value214will be `None` otherwise the entered text.214will be ``None``, otherwise the entered text.215216Example usage::217218 import click
202 unmodified lines