diff options
author | Markus Rossi <markus.rossi@example.com> | 2019-09-06 10:47:09 +0300 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-02-16 16:05:45 -0800 |
commit | f27950c90d65fc4a2a35f2ca81ac83683c0ac324 (patch) | |
tree | c2f1864c4d8defcddefb9b981769fd92bd8fcecb /docs/commands.rst | |
parent | 278a054432dbbe077f8921249d657c992ccf99fb (diff) | |
download | click-f27950c90d65fc4a2a35f2ca81ac83683c0ac324.tar.gz |
add example of default_map with top level option
Diffstat (limited to 'docs/commands.rst')
-rw-r--r-- | docs/commands.rst | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/commands.rst b/docs/commands.rst index 3ee35ab..520e418 100644 --- a/docs/commands.rst +++ b/docs/commands.rst @@ -440,10 +440,18 @@ defaults. This is useful if you plug in some commands from another package but you're not satisfied with the defaults. -The default map can be nested arbitrarily for each subcommand and -provided when the script is invoked. Alternatively, it can also be -overridden at any point by commands. For instance, a top-level command could -load the defaults from a configuration file. +The default map can be nested arbitrarily for each subcommand: + +.. code-block:: python + + default_map = { + "debug": True, # default for a top level option + "runserver": {"port": 5000} # default for a subcommand + } + +The default map can be provided when the script is invoked, or +overridden at any point by commands. For instance, a top-level command +could load the defaults from a configuration file. Example usage: |