Apply suggestions from code review
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Rowlando13 · committed by GitHub · parent 9d7c7dc · Browse files · 1 file·+9 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Andreas Backx <AndreasBackx@users.noreply.github.com>
Diff stats
1 file+9 added−7 removed
- other:+9 added−7 removed
Provenance
- Commit
4336056- Tree
5771eb1- Author
Rowlando13 <67291205+Rowlando13@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
9d7c7dc
1 file changed+9 added−7 removed
modified:docs/documentation.rst+9 added-7 removed
35 unmodified lines36 37 Command Short Help38 ------------------39 40-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``:40+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``:41 42 .. click:example::43 44 @click.group()16 unmodified lines61 The help epilog is printed at the end of the help and is useful for showing example command usages or referencing additional help resources.62 63 .. click:example::64 65- @click.command(epilog='Check out our docs at https://click.palletsprojects.com/ for more details')65+ @click.command(66+ epilog='See https://example.com for more details',67+ )68 def init():69 """Initializes the repository."""70 71 And from the command line:5 unmodified lines77 Documenting Arguments78 ----------------------79 80 :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 text79-by name. For Python that means including them in docstrings.81+by name. This should then be done via the docstring.82 83 A brief example:84 85 .. click:example::112 unmodified lines198 199 invoke(cli, args=['--help'])200 201 200-Placeholder Variable202+Placeholder / Meta Variable203 -----------------------204 205 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.206 3 unmodified lines210 @click.command(options_metavar='[[options]]')211 @click.option('--count', default=1, help='number of greetings',212 metavar='<int>')213 @click.argument('name', metavar='<name>')212- def hello(count, name):213- """This script prints hello to things."""214+ def hello(name: str, count: int) -> None:215+ """This script prints 'hello <name>' a total of <count> times."""216 for x in range(count):217 click.echo(f"Hello {name}!")218 219 Example:3 unmodified lines223 invoke(hello, args=['--help'])224 225 Help Parameter Customization226 ----------------------------225-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.227+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.228 229 This example changes the default parameters to ``-h`` and ``--help``230 instead of just ``--help``:231 13 unmodified lines