Skip to content
Myr

Add more detail to command and group docs.

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

authored by Edward G · committed by Edward G · parent b72256a · Browse files · 2 files+9 added−5 removed
This commit

State

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

Diff stats

2 files+9 added−5 removed

  • other:+9 added−5 removed

2 files+9 added−5 removed

modified:docs/commands-and-groups.rst+8 added-4 removed
166 unmodified lines
167- But ``tool.py --help sub`` treats ``--help`` as an argument for the main program. Click then invokes the callback for ``--help``, which prints the help and aborts the program before click can process the subcommand.168169Arbitrary Nesting170------------------171Commands are attached to a group. Multiple groups can be attached to another group. Groups containing multiple groups can be attached to a group, and so on.172To invoke a command nest under multiple groups, all the above groups must added.171:class:`Commands <Command>` are attached to a :class:`Group`. Multiple groups can be attached to another group. Groups containing multiple groups can be attached to a group, and so on. To invoke a command nested under multiple groups, all the groups under which it is nested must added.172173.. click:example::174175 @click.group()
18 unmodified lines
194 invoke(cli, args=['session', 'initdb'])195196Lazily Attaching Commands197--------------------------199Most examples so far have attached the the commands and group immediately, but commands may be registered later. This could be used to split command into multiple Python modules.198Most examples so far have attached the commands and to a group immediately, but commands may be registered later. This could be used to split commands into multiple Python modules. Regardless of how they are attached, the commands are invoked identically.199200.. click:example::201202 @click.group()
10 unmodified lines
213214 cli.add_command(initdb)215 cli.add_command(dropdb)216217.. click:run::218219 invoke(cli, args=['initdb'])220 invoke(cli, args=['dropdb'])221222Context Object223-------------------220The :class:`Context` object ...224The :class:`Context` object is how commands and groups communicate.
modified:docs/index.rst+1 added-1 removed
74 unmodified lines
75 parameter-types76 options77 option-decorators78 arguments79 commands79 commands-and-groups80 commands81 documentation82 prompts83 complex84 advanced
27 unmodified lines