Configuration files

The structure of the configuration file is derived from the CLI’s parameters and their types. You never write a data structure to mirror the CLI.

Tip

After loading, the resolved file path, the full parsed document, and (when a config_schema is set) the typed app section are exposed on ctx.meta as CONF_SOURCE, CONF_FULL, and TOOL_CONFIG. With cascade=True, CONF_SOURCES additionally lists every file that was loaded. See the available keys table to read them from your own callbacks.

Resolving a configuration file

Before any value is read, Click Extra decides which file, if any, provides the configuration. An explicit --config (or its environment variable or interactive prompt) wins outright. An explicit location with nothing to read, like an empty file or /dev/null (nul on Windows), loads an empty configuration: every parameter keeps its default. Otherwise autodiscovery applies: pyproject.toml is searched from the current directory up to the VCS root, then the app-dir search pattern takes over. The first file that parses to a non-empty mapping is used, with no merging across files.

        flowchart TD
    start(["@config_option resolves a pattern"]) --> nc{"autodiscovery disabled?"}
    nc -->|yes| skip["Skip loading, use bare defaults"]
    nc -->|no| exp{"--config, env or prompt set?"}
    exp -->|"no, auto-discover"| pyp{"pyproject.toml format enabled?"}
    pyp -->|yes| cwd{"tool.cli table in a pyproject.toml, CWD up to VCS root?"}
    cwd -->|yes| usepyp["Use that tool.cli section"]
    cwd -->|no| search["Search files matching the pattern, try formats in order"]
    pyp -->|no| search
    exp -->|yes| search
    search --> parse{"a file parses to a non-empty config?"}
    parse -->|yes| win["First match wins, no merging"]
    parse -->|"no, auto-discover"| defaults["Use bare defaults"]
    parse -->|"no, explicit"| empty{"an empty file matched?"}
    empty -->|yes| defaults
    empty -->|no| fail["Exit with code 2"]
    

Once a file is selected, its values feed into the precedence chain below: environment variables, CLI parameters, and interactive prompts all override what the file provides.

Standalone option

The @config_option decorator provided by Click Extra can be used as-is with vanilla Click:

from click import group, option, echo
from click_extra import config_option

@group(context_settings={"show_default": True})
@option("--dummy-flag/--no-flag")
@option("--my-list", multiple=True)
@config_option
def my_cli(dummy_flag, my_list):
    echo(f"dummy_flag    is {dummy_flag!r}")
    echo(f"my_list       is {my_list!r}")

@my_cli.command
@option("--int-param", type=int, default=10)
def subcommand(int_param):
    echo(f"int_parameter is {int_param!r}")

The code above is saved in a file named my_cli.py. It produces the following help screen:

$ my-cli --help
Usage: my-cli [OPTIONS] COMMAND [ARGS]...

Options:
  --dummy-flag / --no-flag  [default: no-flag]
  --my-list TEXT
  --config LOCATION         Location of the configuration file. Supports local
                            path with glob patterns or remote URL.  [default:
                            ~/.config/my-cli/]
  --help                    Show this message and exit.

Commands:
  subcommand

The help screen names the default location of the configuration file ([default: ~/.config/my-cli/]). This improves discoverability, and makes sysadmins happy, especially those not familiar with your CLI. The files searched in that folder depend on the formats you enabled.

A bare call returns:

$ my-cli subcommand
dummy_flag    is False
my_list       is ()
int_parameter is 10

A TOML file in the application folder changes the CLI’s defaults. Here is what ~/.config/my-cli/config.toml contains:

~/.config/my-cli/config.toml
# My default configuration file.
top_level_param = "is_ignored"

[my-cli]
extra_value = "is ignored too"
dummy_flag = true                                  # New boolean default.
my_list = ["item 1", "item #2", "Very Last Item!"]

[garbage]
# An empty random section that will be skipped.

[my-cli.subcommand]
int_param = 3
random_stuff = "will be ignored"

In the file above, note:

  • The default configuration base path, which is OS-dependent (the ~/.config/my-cli/ path here is for Linux).

  • The app’s folder (/my-cli/), built from the script’s name (my_cli.py).

  • The top-level config section ([my-cli]), based on the CLI’s group ID (def my_cli()).

  • The extra comments, sections and values, all silently ignored.

The configuration file is read and changes the defaults:

$ my-cli subcommand
dummy_flag    is True
my_list       is ('item 1', 'item #2', 'Very Last Item!')
int_parameter is 3

Key spelling

Configuration keys address CLI parameters by name, in either of two spellings:

  • kebab-case is the canonical presentation: it matches the spelling of the CLI flags and the convention of TOML and YAML files. It is what --export-config emits.

  • snake_case is the parameter’s internal ID, which Click derives from the flag by replacing hyphens with underscores: the --dummy-flag option is the dummy_flag parameter. This ID is what --params reports, and what roots the auto-generated environment variable (CLI_DUMMY_FLAG), since neither Python identifiers nor environment variables can carry dashes.

Both spellings resolve to the same parameter: dummy-flag and dummy_flag both set --dummy-flag. When the two coexist in a file, the last one in file order wins and a warning names both.

Case does not have to match either. Click folds case when it derives a parameter name from a flag, so --Dummy-Flag would also be the dummy_flag parameter, and a key spelled Dummy-Flag or DUMMY_FLAG reaches it too.

Caution

Folding is how the key is found, never how the parameter is named. Click takes a third positional declaration verbatim, so a parameter declared @option("--flag", "Dummy_Flag") really is named Dummy_Flag, and its config key keeps that case. A key is matched against the names a CLI declares, so a CLI that declares both dummy_flag and Dummy_Flag leaves DUMMY_FLAG addressing neither: nothing tells the two apart, and the key is skipped with a warning.

Note

Click also accepts snake_case flags: --my_option is legal and derives the same my_option parameter ID as --my-option would. For such a CLI the canonical config key is still the kebab-cased my-option, which loads back to the same parameter.

Decoupling the flag from the configuration key

Click’s third positional declaration names the parameter explicitly, decoupling it from the flags. This is handy for repeatable options, where the flag names one occurrence but the configuration key holds the whole collection: keep the flag singular and pluralize the parameter, so the config key, the environment variable and the callback argument all read as the list they are.

from click_extra import command, echo, option

@command
@option("--hash-header", "hash_headers", multiple=True)
def scanner(hash_headers):
    echo(f"headers = {hash_headers!r}")

The --hash-header flag is repeated once per value:

$ scanner --hash-header Date --hash-header From
headers = ('Date', 'From')

While the configuration key, shown here by exporting the values just set, is the plural hash-headers list:

$ scanner --hash-header Date --hash-header From --export-config toml
[scanner]
hash-headers = ["Date", "From"]
time = false
accessible = false
color = "auto"
no-color = false
progress = true
theme = "dark"
table-format = "rounded-outline"
verbosity = "WARNING"
verbose = 0
quiet = 0
debug = false
tree = false
man = false
# help-format =

The environment variable follows the parameter ID too, so a single SCANNER_HASH_HEADERS value feeds the whole list.

Dotted keys

Configuration files support dotted keys as a shorthand for nested structures. Instead of writing:

Nested structure
[my-cli.subcommand]
int_param = 3

You can write:

Dotted key equivalent
[my-cli]
"subcommand.int_param" = 3

Both forms are equivalent. You can also freely mix them in the same file:

Mixed dotted and nested keys in JSON
{
    "my-cli": {
        "dummy_flag": true,
        "subcommand.int_param": 3,
        "subcommand": {
            "other_param": "value"
        }
    }
}

Dotted keys are expanded into nested dicts and deep-merged before the configuration is applied. This works across all supported formats, and at any nesting depth (for example, "subcommand.nested.option" expands to three levels).

The expansion stops at an extension point. Its keys are data, so a dot inside one is part of the key.

Hint

This is especially handy in formats like JSON that have no native section syntax, letting you keep a flat structure when the nesting would be excessive.

Merge rules

When dotted keys and nested structures target the same leaf, the last one in file order wins:

Last value wins
{
    "my-cli": {
        "subcommand": {"int_param": 3},
        "subcommand.int_param": 77
    }
}

Here int_param resolves to 77 because the dotted key appears after the nested one.

Conflicts

A conflict occurs when the same key is used as both a scalar and a namespace. For example:

Conflicting types on the same key
{
    "my-cli": {
        "subcommand": "some_value",
        "subcommand.int_param": 3
    }
}

Here subcommand is a plain string, but subcommand.int_param requires it to be a dict. By default, Click Extra logs a warning and the last value wins: in this case, subcommand becomes {"int_param": 3}, silently dropping "some_value".

In strict mode, conflicts and invalid dotted keys are reported as validation errors instead of being silently resolved.

The same conflict detection applies at deeper levels:

Deep conflict
{
    "my-cli": {
        "subcommand.int_param.nested": 1,
        "subcommand.int_param": 2
    }
}

Here int_param is set to both {"nested": 1} (via the first key) and 2 (via the second). A warning is logged and int_param resolves to 2.

Note

Most formats prevent these conflicts at parse time (TOML rejects a key used as both a scalar and a table, YAML forbids duplicate keys), so in practice this mainly affects JSON.

Invalid dotted keys

Dotted keys with empty segments (leading, trailing, or consecutive dots) are skipped with a warning:

Invalid keys that are skipped
{
    "my-cli": {
        ".option": 1,
        "option.": 2,
        "sub..option": 3
    }
}

All three keys above are ignored. Use --verbosity WARNING or higher to see the warnings. In strict mode, they are reported as validation errors.

Precedence

The loader fetches values in the following precedence order:

        flowchart TD
    P["Interactive prompt"] -->|unset| C["CLI parameters"]
    C -->|unset| E["Environment variables"]
    E -->|unset| F["Configuration file"]
    F -->|unset| D["Defaults"]
    

Each parameter takes the first value set in that chain.

Configuration file values are loaded into Click’s default_map, so they are reported as DEFAULT_MAP and sit below environment variables in the hierarchy.

Inline parameters take priority over the file’s defaults:

$ my-cli subcommand --int-param 555
dummy_flag    is True
my_list       is ('item 1', 'item #2', 'Very Last Item!')
int_parameter is 555

Get configuration values

The resolved values are merged into the context’s default_map. Only values matching a CLI parameter are kept and passed as defaults. All others are silently ignored.

The full configuration stays accessible in the context’s meta attribute:

from click_extra import option, echo, pass_context, command


@command
@option("--int-param", type=int, default=10)
@pass_context
def my_cli(ctx, int_param):
    echo(f"Configuration location: {ctx.meta['click_extra.conf_source']}")
    echo(f"Full configuration: {ctx.meta['click_extra.conf_full']}")
    echo(f"Default values: {dict(ctx.default_map)}")
    echo(f"int_param is {int_param!r}")
./conf.toml
[my-cli]
int_param = 3
random_stuff = "will be ignored"

[garbage]
dummy_flag = true
$ my-cli --config /tmp/tmpy1qa73yq/conf.toml --int-param 999
Load configuration matching /tmp/tmpy1qa73yq/conf.toml
Configuration location: /tmp/tmpy1qa73yq/conf.toml
Full configuration: {'my-cli': {'int_param': 3, 'random_stuff': 'will be ignored'}, 'garbage': {'dummy_flag': True}}
Default values: {'int_param': 3}
int_param is 999

The Load configuration matching line goes to stderr. -q, or a --verbosity above WARNING, silences it, like the --no-config line.

Hint

Variables in meta are presented in their original Python type:

  • click_extra.conf_source is a normalized Path, or the URL the configuration was downloaded from, as a str

  • click_extra.conf_full is a dict whose values are either str or richer types, depending on the capabilities of each format

Exporting the configuration

The @export_config_option decorator adds a --export-config FORMAT option that resolves the CLI’s current configuration and writes it to <stdout> as a ready-to-use configuration file, then exits. It is part of the default options of every @command and @group, so click-extra CLIs ship with it out of the box.

The values are resolved through the usual precedence chain: command-line parameters override environment variables, which override an autodiscovered configuration file, which overrides the defaults. So combining --export-config with other options or environment variables captures them in the generated configuration, which makes it a convenient way to freeze the current invocation into a file or to produce a starting-point template.

from click_extra import command, echo, option

@command
@option("--city", default="Lisbon")
@option("--temperature", type=int, default=18)
@option("--tags", multiple=True, default=("sunny",))
def weather(city, temperature, tags):
    echo(f"{city}: {temperature}C {tags!r}")

A bare export renders every configurable parameter, including click-extra’s own built-in options:

$ weather --export-config toml
[weather]
city = "Lisbon"
temperature = 18
tags = ["sunny"]
time = false
accessible = false
color = "auto"
no-color = false
progress = true
theme = "dark"
table-format = "rounded-outline"
verbosity = "WARNING"
verbose = 0
quiet = 0
debug = false
tree = false
man = false
# help-format =

Any value set on the command line (or via an environment variable) is reflected in the export, so the output can be saved straight into a configuration file:

$ weather --city Oslo --temperature 4 --export-config toml
[weather]
city = "Oslo"
temperature = 4
tags = ["sunny"]
time = false
accessible = false
color = "auto"
no-color = false
progress = true
theme = "dark"
table-format = "rounded-outline"
verbosity = "WARNING"
verbose = 0
quiet = 0
debug = false
tree = false
man = false
# help-format =

Redirect the output to your configuration file to persist it:

$ weather --city Oslo --export-config toml > ~/.config/weather/config.toml

The accepted formats are the ones click-extra can serialize: toml, yaml, json, json5, jsonc, hjson, xml and plist. ini, sqlite, argfile and pyproject.toml have no serializer and cannot be exported. A format whose optional dependency is missing exits with code 1 and an install hint.

Exported keys use the canonical kebab-case spelling (see Key spelling), so the generated file reads like the CLI flags it mirrors.

Parameters without a value are exported too, so the generated file names every key a configuration file can set. Multi-value parameters read as empty lists, and unset scalars render as null, except in TOML which has no null type and comments them out:

from click_extra import command, echo, option

@command
@option("--regexp")
@option("--tags", multiple=True)
def filters(regexp, tags):
    echo(f"{regexp!r} {tags!r}")
$ filters --export-config toml
[filters]
# regexp =
tags = []
time = false
accessible = false
color = "auto"
no-color = false
progress = true
theme = "dark"
table-format = "rounded-outline"
verbosity = "WARNING"
verbose = 0
quiet = 0
debug = false
tree = false
man = false
# help-format =

If a configuration file is discovered or passed via --config, its values are loaded before the export renders, so the output reflects the full precedence chain regardless of the order of the flags on the command line. The same guarantee applies to --params.

Note

--export-config is itself excluded from the export, like the other introspection options (--help, --version, --params, --validate-config). It requires a sibling @config_option decorator to be present on the same command.

Excluding parameters

The excluded_params argument blocks listed CLI options from being loaded from configuration.

It defaults to the value of DEFAULT_EXCLUDED_PARAMS, plus the CLI’s --help option, resolved at runtime.

Set your own blocklist with the excluded_params argument:

from click import command, option, echo

from click_extra import config_option

@command
@option("--int-param", type=int, default=10)
@config_option(excluded_params=["my-cli.non_configurable_option", "my-cli.dangerous_param"])
def my_cli(int_param):
    echo(f"int_parameter is {int_param!r}")

Hint

Provide the fully-qualified ID of the option to block: the dot-separated ID prefixed by the CLI name. This reaches options at any level, including subcommands.

To discover options and their IDs, run your CLI with the --params option.

On the default @command and @group decorators, the excluded_params keyword extends the blocklist without replacing the whole default parameter list. Unlike the option-level argument above, it is additive: the built-in exclusions (--config, --version, --help, …) are preserved and your IDs are unioned into them.

from click_extra import command

@command(excluded_params=["my-cli.dangerous_param"])
def my_cli(): ...

Under strict mode, a blocked parameter found in a configuration file is refused with a dedicated message naming it as not allowed, rather than unknown.

Including parameters

The included_params argument is the inverse of excluded_params: only the listed parameters will be loaded from the configuration file. All other parameters found in the configuration will be ignored.

from click import command, option, echo

from click_extra import config_option

@command
@option("--flag-a/--no-flag-a")
@option("--flag-b/--no-flag-b")
@config_option(included_params=("my-cli.flag_a",))
def my_cli(flag_a, flag_b):
    echo(f"flag_a={flag_a!r}")
    echo(f"flag_b={flag_b!r}")

In the example above, only flag_a will be loaded from configuration. flag_b will keep its CLI default even if it is present in the configuration file.

Caution

included_params and excluded_params are mutually exclusive. Providing both will raise a ValueError.

Hint

Like excluded_params, this takes fully-qualified option IDs. Run your CLI with the --params option to discover them.

Schema-only configuration

When using config_schema for typed configuration access, your config keys typically don’t correspond to CLI parameters: they’re custom fields consumed via get_tool_config(). In that case, merging them into default_map is unnecessary and can cause collisions if a config key happens to share a name with a subcommand.

Set included_params=() (empty tuple) to merge nothing into default_map. All configuration access goes through the schema, which also reports the keys it does not know: the strict check and --validate-config leave such a section to it.

from dataclasses import dataclass
from click_extra import group, pass_context
from click_extra.config import get_tool_config


@dataclass
class AppConfig:
    setup_guide: bool = True
    sync_interval: int = 60


@group(config_schema=AppConfig, schema_strict=True, included_params=())
@pass_context
def my_app(ctx):
    config = get_tool_config(ctx)
    # config is always an AppConfig instance, never None

Note

included_params=() is different from included_params=None. None means “not configured, use the default behavior” (which applies excluded_params). () means “the allowlist is explicitly empty: merge nothing into default_map.”

Disabling autodiscovery

By default, @config_option automatically searches for configuration files in the default application folder. If you want to disable this autodiscovery and only load a configuration file when the user explicitly passes --config <path>, use the NO_CONFIG sentinel as the default:

from click import group, option, echo
from click_extra import config_option, NO_CONFIG

@group(context_settings={"show_default": True})
@option("--dummy-flag/--no-flag")
@config_option(default=NO_CONFIG)
def my_cli(dummy_flag):
    echo(f"dummy_flag is {dummy_flag!r}")

With this setup:

  • The --help output shows [default: disabled] instead of a filesystem path.

  • Running the CLI without --config produces no configuration-related output on stderr.

  • Users can still explicitly pass --config <path> to load a specific configuration file.

  • The --no-config flag (if added via @no_config_option) still prints the “Skip configuration file loading altogether.” message when used explicitly, unless -q, or a --verbosity above WARNING, silences it.

This is useful for CLIs where configuration files are opt-in rather than opt-out, or when you want to avoid side effects from automatically discovered configuration files during development or testing.

Default subcommands

You can specify which subcommands run by default when a group is invoked without any explicit subcommands on the CLI. This is done via the _default_subcommands reserved configuration key.

Note

Both reserved keys are honored by whichever group carries the --config option, not only by click_extra.group. A third-party framework building its own group on click.Group or cloup.Group gets them too, as long as it attaches @config_option. A subgroup reached through an ancestor’s --config carries no option of its own, and reads its own [my-cli.subgroup] section all the same, whatever class it is built on.

Caution

Click’s no_args_is_help prints the help screen for a bare invocation before any option is processed, which is before the configuration is read. Click Extra steps around this on every group carrying --config: it reads the configuration first, and runs the subcommands either key names in place of the help screen. A group built on plain click.Group or cloup.Group offers no hook for that, nor for the section of a subgroup, so the first @config_option a process declares replaces click.Group.parse_args for the whole process. A CLI with no --config option is left to Click.

Given this CLI:

from click_extra import echo, group, option


@group
def my_cli():
    pass


@my_cli.command()
@option("--path", default="/tmp")
def backup(path):
    echo(f"Backing up {path}")


@my_cli.command()
def sync():
    echo("Syncing")

And this TOML configuration:

[my-cli]
_default_subcommands = ["backup"]

[my-cli.backup]
path = "/home"

Running my-cli alone will automatically invoke the backup subcommand:

$ my-cli --config /tmp/tmpp0cuqy8o/my-cli.toml
Load configuration matching /tmp/tmpp0cuqy8o/my-cli.toml
Backing up /home

Chained commands

For groups created with chain=True, you can list multiple default subcommands. They run in the order specified. The rest of this section builds on a chained variant of the CLI above, with a debug subcommand to prepend later:

from click_extra import echo, group, option


@group(chain=True)
def my_cli():
    pass


@my_cli.command()
@option("--path", default="/tmp")
def backup(path):
    echo(f"Backing up {path}")


@my_cli.command()
def sync():
    echo("Syncing")


@my_cli.command()
def debug():
    echo("Debug mode activated")
[my-cli]
_default_subcommands = ["backup", "sync"]
$ my-cli --config /tmp/tmp73yioyw9/my-cli.toml
Load configuration matching /tmp/tmp73yioyw9/my-cli.toml
Backing up /home
Syncing

Note

Non-chained groups only accept a single default subcommand. Listing more than one will produce an error.

CLI precedence

If the user names subcommands explicitly on the command line, the _default_subcommands configuration is ignored:

$ my-cli --config /tmp/tmpflne0_2z/my-cli.toml sync
Load configuration matching /tmp/tmpflne0_2z/my-cli.toml
Syncing

Prepend subcommands

The _prepend_subcommands key always prepends subcommands to every invocation, regardless of whether CLI subcommands are provided. This is useful for always injecting a subcommand (like debug) on a dev machine.

Important

_prepend_subcommands only works with chain=True groups. Non-chained groups resolve exactly one subcommand, so prepending would break the user’s intended command.

[my-cli]
_prepend_subcommands = ["debug"]

Running my-cli sync effectively becomes my-cli debug sync:

$ my-cli --config /tmp/tmplnsjl63k/my-cli.toml sync
Load configuration matching /tmp/tmplnsjl63k/my-cli.toml
Debug mode activated
Syncing

_default_subcommands with _prepend_subcommands

When both keys are set and no CLI subcommands are given, _default_subcommands fires first, then _prepend_subcommands is prepended. The result is [*prepend, *defaults]:

[my-cli]
_default_subcommands = ["sync"]
_prepend_subcommands = ["debug"]
$ my-cli --config /tmp/tmpdeoylsok/my-cli.toml
Load configuration matching /tmp/tmpdeoylsok/my-cli.toml
Debug mode activated
Syncing

When CLI subcommands are given explicitly, _default_subcommands is ignored but _prepend_subcommands still applies:

$ my-cli --config /tmp/tmpr3rocarg/my-cli.toml backup
Load configuration matching /tmp/tmpr3rocarg/my-cli.toml
Debug mode activated
Backing up /tmp

Fallback sections

When a CLI tool is renamed, existing configuration files may still use the old section name. The fallback_sections parameter lets you accept legacy names with a deprecation warning:

from dataclasses import dataclass
from click_extra import echo, group, pass_context
from click_extra.config import get_tool_config

@dataclass
class ToolConfig:
    value: str = "default"

@group(
    config_schema=ToolConfig,
    fallback_sections=("old-tool-name", "even-older-name"),
)
@pass_context
def new_tool(ctx):
    """A tool that was renamed."""
    config = get_tool_config(ctx)
    if config is not None:
        echo(f"value: {config.value}")

@new_tool.command()
def run():
    """Run the tool."""
    echo("done")

With the following TOML:

Legacy configuration still using the old name.
[old-tool-name]
value = "from-legacy"

The CLI loads the [old-tool-name] section and logs a deprecation warning to stderr:

Config section [old-tool-name] is deprecated, migrate to [new-tool].

If both [new-tool] and [old-tool-name] exist, the current name always wins, and a warning is emitted about the leftover legacy section.

$ new-tool --help
Usage: new-tool [OPTIONS] COMMAND [ARGS]...

  A tool that was renamed.

Options:
  -h, --help                   Show this message and exit.

Configuration options:
  --config LOCATION            Location of the configuration file. Supports
                               local path with glob patterns or remote URL.
                               [default: ~/.config/new-tool/]
  --no-config                  Ignore all configuration files and only use
                               command line parameters and environment
                               variables.
  --validate-config LOCATION   Validate the configuration file and exit.
  --export-config FORMAT       Export the configuration in the selected format
                               to <stdout>, then exit.

Output options:
  --accessible                 Accessibility mode: disable colors and render
                               tables in a borderless, screen-reader-friendly
                               format.
  --color [auto|always|never]  Colorize the output. A bare --color is the same
                               as --color=always.  [default: auto]
  --no-color                   Disable colorization (alias of --color=never).
  --progress / --no-progress   Show progress indicators during long operations.
                               Disabled for non-interactive output (pipes, dumb
                               terminals, CI) and by --accessible.  [default:
                               progress]
  --theme [auto|dark|dracula|light|manpage|monokai|nord|solarized-dark]
                               Color theme used for help screens.  [default:
                               dark]
  --table-format FORMAT        Rendering style of tables.  [default: rounded-
                               outline]

Logging options:
  --verbosity LEVEL            Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
                               [default: WARNING]
  -v, --verbose                Increase the default WARNING verbosity by one
                               level for each additional repetition of the
                               option.  [default: 0]
  -q, --quiet                  Decrease the default WARNING verbosity by one
                               level for each additional repetition of the
                               option.  [default: 0]
  --debug                      Shorthand for --verbosity DEBUG.

Introspection options:
  --time / --no-time           Measure and print elapsed execution time.
                               [default: no-time]
  --params                     Show all CLI parameters, their provenance,
                               defaults and value, then exit.
  --tree                       Show the tree of nested subcommands and exit.
  --man                        Read the command's manual page and exit.
  --help-format [carapace|json|json-full|man|markdown|markdown-full]
                               Render the command in the given format and exit.
  --version                    Show the version and exit.

Commands:
  help  Show help for a command.
  run   Run the tool.

This works identically across all configuration formats (TOML, YAML, JSON, INI, etc.), since the section lookup operates on the normalized dict structure after parsing.