Skip to content
Myr

parameters.rst

This file

Path

docs/parameters.rst

58 lines · 2.1 KiB

Last changed by

Rewrite Commands and Groups docs. (#2838)Rowlando13before adoption0bf333e

History of this file

Take it

The walk stopped after 200 commits: lines older than 8b48450 point at it.

Rewrite Commands and Groups docs. (#2838)Rowlando13before adoption0bf333e

lines 1–2why, one step back
1.. _parameters:
2

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

lines 3–7why, one step back
3Parameters
4==========56.. currentmodule:: click7

Rewrite first half of options docs (#2825)Rowlando13before adoption82089af

line 8why, one step back
8Click supports only two principle types of parameters for scripts (by design): options and arguments.

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 9why, one step back
9

Merge stable into main (#2799)Rowlando13before adoptiond791537

lines 10–11why, one step back
10Options
11----------------

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 12why, one step back
12

Merge stable into main (#2799)Rowlando13before adoptiond791537

lines 13–19why, one step back
13* Are optional.
14* Recommended to use for everything except subcommands, urls, or files.15* Can take a fixed number of arguments. The default is 1. They may be specified multiple times using :ref:`multiple-options`.16* Are fully documented by the help page.17* Have automatic prompting for missing input.18* Can act as flags (boolean or otherwise).19* Can be pulled from environment variables.

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 20why, one step back
20

Merge stable into main (#2799)Rowlando13before adoptiond791537

lines 21–22why, one step back
21Arguments
22----------------

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 23why, one step back
23

Merge stable into main (#2799)Rowlando13before adoptiond791537

lines 24–28why, one step back
24* Are optional with in reason, but not entirely so.
25* Recommended to use for subcommands, urls, or files.26* Can take an arbitrary number of arguments.27* Are not fully documented by the help page since they may be too specific to be automatically documented. For more see :ref:`documenting-arguments`.28* Can be pulled from environment variables but only explicitly named ones. For more see :ref:`environment-variables`.

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 29why, one step back
29

Rewrite first half of options docs (#2825)Rowlando13before adoption82089af

lines 30–31why, one step back
30On each principle type you can specify :ref:`parameter-types`. Specifying these types helps Click add details to your help pages and help with the handling of those types.
31

Merge stable into main (#2799)Rowlando13before adoptiond791537

line 32why, one step back
32.. _parameter_names:

Fix typo in docstring (change "appnd" to "append") (#1950)Deepyaman Dattabefore adoption8b48450

line 33why, one step back
33

Merge stable into main (#2799)Rowlando13before adoptiond791537

lines 34–58why, one step back
34Parameter Names
35---------------3637Parameters (options and arguments) have a name that will be used as38the Python argument name when calling the decorated function with39values.4041.. click:example::4243 @click.command()44 @click.argument('filename')45 @click.option('-t', '--times', type=int)46 def multi_echo(filename, times):47 """Print value filename multiple times."""48 for x in range(times):49 click.echo(filename)5051In the above example the argument's name is ``filename``. The name must match the python arg name. To provide a different name for use in help text, see :ref:`doc-meta-variables`.52The option's names are ``-t`` and ``--times``. More names are available for options and are covered in :ref:`options`.5354And what it looks like when run:5556.. click:run::5758 invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')