Skip to content
Myr

Merge pull request #163 from untitaker/doc_fixes

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

Some docs fixes

authored by Armin Ronacher · committed by Armin Ronacher · parents e55bd66, bfe0c58 · Browse files · 1 file+23 added−3 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+23 added−3 removed

  • other:+23 added−3 removed

1 file+23 added−3 removed

modified:docs/commands.rst+23 added-3 removed
9 unmodified lines
10Callback Invocation11-------------------1213For a regular command, the callback is executed whenever the command runs.14If the script is the only command, it will always fire (unless a15parameter callback prevents it). This for instance happens if someone16passes ``--help`` to the script).14If the script is the only command, it will always fire (unless a parameter15callback prevents it. This for instance happens if someone passes16``--help`` to the script).1718For groups and multi commands, the situation looks different. In this case,19the callback fires whenever a subcommand fires (unless this behavior is20changed). What this means in practice is that an outer command runs
17 unmodified lines
38 invoke(cli, prog_name='tool.py')39 println()40 invoke(cli, prog_name='tool.py', args=['--debug', 'sync'])4142Passing Parameters43------------------4445Click strictly separates parameters between commands and subcommands. What this46means is that options and arguments for a specific command have to be specified47*after* the command name itself, but *before* any other command names.4849This behavior is already observable with the predefined ``--help`` option.50Suppose we have a program called ``tool.py``, containing a subcommand called51``sub``.5253- ``tool.py --help`` will return the help for the whole program (listing54 subcommands).5556- ``tool.py sub --help`` will return the help for the ``sub`` subcommand.5758- But ``tool.py --help sub`` will treat ``--help`` as an argument for the main59 program. Click then invokes the callback for ``--help``, which prints the60 help and aborts the program before click can process the subcommand.6162Nested Handling and Contexts63----------------------------6465As you can see from the earlier example, the basic command group accepts a
297 unmodified lines