Convert parameters file to md. (#2953)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Rowlando13 · committed by GitHub · parents 3a917b9, 3aebc6e · Browse files · 3 files·+57 added−59 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+57 added−59 removed
- other:+57 added−59 removed
Provenance
- Commit
a6cc378- Tree
6b17a0d- Author
Rowlando13 <67291205+Rowlando13@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent 1
3a917b9- Parent 2
3aebc6e
3 files changed+57 added−59 removed
modified:docs/documentation.rst+2 added-1 removed
197 unmodified lines198 .. code-block:: python199 200 cli(max_content_width=120)201 202-.. _doc-meta-variables:202 203+204 Truncating Help Texts205 ---------------------206 207 Click gets :class:`Command` help text from the docstring. If you do not want to include part of the docstring, add the ``\f`` escape marker to have Click truncate the help text after the marker.13 unmodified lines221 .. click:run::222 223 invoke(cli, args=['--help'])224 225+.. _doc-meta-variables:226 227 Placeholder / Meta Variable228 -----------------------------229 39 unmodified linesadded:docs/parameters.md+55 added
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455(parameters)=
# Parameters
```{currentmodule} click```
Click supports only two principle types of parameters for scripts (by design): options and arguments.
## Options
- Are optional.- Recommended to use for everything except subcommands, urls, or files.- Can take a fixed number of arguments. The default is 1. They may be specified multiple times using {ref}`multiple-options`.- Are fully documented by the help page.- Have automatic prompting for missing input.- Can act as flags (boolean or otherwise).- Can be pulled from environment variables.
## Arguments
- Are optional with in reason, but not entirely so.- Recommended to use for subcommands, urls, or files.- Can take an arbitrary number of arguments.- Are not fully documented by the help page since they may be too specific to be automatically documented. For more see {ref}`documenting-arguments`.- Can be pulled from environment variables but only explicitly named ones. For more see {ref}`environment-variables`.
On 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.
(parameter-names)=
## Parameter Names
Parameters (options and arguments) have a name that will be used asthe Python argument name when calling the decorated function withvalues.
In the 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`.The option's names are `-t` and `--times`. More names are available for options and are covered in {ref}`options`.
```{eval-rst}.. click:example::
@click.command() @click.argument('filename') @click.option('-t', '--times', type=int) def multi_echo(filename, times): """Print value filename multiple times.""" for x in range(times): click.echo(filename)
.. click:run::
invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')```deleted:docs/parameters.rst-58 removed
1-.. _parameters:2-3-Parameters4-==========5-6-.. currentmodule:: click7-8-Click supports only two principle types of parameters for scripts (by design): options and arguments.9-10-Options11-----------------12-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.20-21-Arguments22-----------------23-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`.29-30-On 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-32-.. _parameter_names:33-34-Parameter Names35----------------36-37-Parameters (options and arguments) have a name that will be used as38-the Python argument name when calling the decorated function with39-values.40-41-.. click:example::42-43- @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)50-51-In 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`.52-The option's names are ``-t`` and ``--times``. More names are available for options and are covered in :ref:`options`.53-54-And what it looks like when run:55-56-.. click:run::57-58- invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')