Skip to content
Myr

docs note that default for multiple=True should be a list

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

authored by Brad Porter · committed by David Lord · parent 5e8c92e · Browse files · 1 file+16 added−5 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+16 added−5 removed

  • other:+16 added−5 removed

1 file+16 added−5 removed

modified:docs/options.rst+16 added-5 removed
167 unmodified lines
168.. click:run::169170 invoke(commit, args=['-m', 'foo', '-m', 'bar'])171172When passing a ``default`` with ``multiple=True``, the default value173must be a list or tuple, otherwise it will be interpreted as a list of174single characters.175176.. code-block:: python177178 @click.option("--format", multiple=True, default=["json"])179180181Counting182--------183184In some very rare circumstances, it is interesting to use the repetition
164 unmodified lines
349 invoke(digest, args=['--hash-type=foo'])350 println()351 invoke(digest, args=['--help'])352344.. note::353Only pass the choices as list or tuple. Other iterables (like354generators) may lead to unexpected results.355346 You should only pass the choices as list or tuple. Other iterables (like347 generators) may lead to surprising results.356Choices work with options that have ``multiple=True``. If a ``default``357value is given with ``multiple=True``, it should be a list or tuple of358valid choices.359349 Choices should be unique after considering the effects of350 ``case_sensitive`` and any specified token normalization function.360Choices should be unique after considering the effects of361``case_sensitive`` and any specified token normalization function.362363.. versionchanged:: 7.1364 The resulting value from an option will always be on the of the365 originally passed choices regardless of ``case_sensitive``.
458 unmodified lines