You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation.rst
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ Simple example:
35
35
Command Short Help
36
36
------------------
37
37
38
-
For sub commands, a short help snippet is generated. By default, it's the first sentence of the docstring. If it is too long, then it will show as much as it can on one line and end with ``...``. The short help snippet can also be overridden with the kwarg ``short_help``:
38
+
For subcommands, a short help snippet is generated. By default, it's the first sentence of the docstring. If too long, then it will ellipsize what cannot be fit on a single line with ``...``. The short help snippet can also be overridden with ``short_help``:
39
39
40
40
.. click:example::
41
41
@@ -59,7 +59,9 @@ The help epilog is printed at the end of the help and is useful for showing exam
59
59
60
60
.. click:example::
61
61
62
-
@click.command(epilog='Check out our docs at https://click.palletsprojects.com/ for more details')
62
+
@click.command(
63
+
epilog='See https://example.com for more details',
64
+
)
63
65
def init():
64
66
"""Initializes the repository."""
65
67
@@ -72,7 +74,7 @@ Documenting Arguments
72
74
----------------------
73
75
74
76
:class:`click.argument` does not take a ``help`` parameter. This follows the Unix Command Line Tools convention of using arguments only for necessary things and documenting them in the command help text
75
-
by name. For Python that means including them in docstrings.
77
+
by name. This should then be done via the docstring.
76
78
77
79
A brief example:
78
80
@@ -185,7 +187,7 @@ Example:
185
187
invoke(cli, args=['--help'])
186
188
187
189
188
-
Placeholder Variable
190
+
Placeholder / Meta Variable
189
191
-----------------------
190
192
191
193
The default placeholder variable (`meta variable <https://en.wikipedia.org/wiki/Metasyntactic_variable#IETF_Requests_for_Comments>`_) in the help pages is the parameter name in uppercase with underscores. This can be changed for Commands and Parameters with the ``options_metavar`` and ``metavar`` kwargs.
@click.option('--count', default=1, help='number of greetings',
198
200
metavar='<int>')
199
201
@click.argument('name', metavar='<name>')
200
-
def hello(count, name):
201
-
"""This script prints hello to things."""
202
+
def hello(name: str, count: int) -> None:
203
+
"""This script prints 'hello <name>' a total of <count> times."""
202
204
for x in range(count):
203
205
click.echo(f"Hello {name}!")
204
206
@@ -210,7 +212,7 @@ Example:
210
212
211
213
Help Parameter Customization
212
214
----------------------------
213
-
The help parameter(s) is automatically added by Click for any command. The default is ``--help`` but can be override by the context setting :attr:`~Context.help_option_names`. Click also performs automatic conflict resolution on the default help parameter so if a command itself implements a parameter named ``help`` then the default help will no be run.
215
+
Help parameters are automatically added by Click for any command. The default is ``--help`` but can be override by the context setting :attr:`~Context.help_option_names`. Click also performs automatic conflict resolution on the default help parameter so if a command itself implements a parameter named ``help`` then the default help will not be run.
214
216
215
217
This example changes the default parameters to ``-h`` and ``--help``
0 commit comments