click_extra.config.flags module¶

Translate a configuration table into command-line flags.

click_extra.config.flags.config_table_to_flags(table)[source]¶

Translate a mapping of configuration keys into long-form CLI flags.

For tools whose command-line options mirror their configuration keys but which cannot read the table themselves (no --config support, no native config file). Follows the conventional mapping:

  • key = True → --key

  • key = "value" (or a number) → --key=value

  • key = ["a", "b"] → --key=a --key=b (one flag per item)

  • key = False is skipped: there is no universal --no-<key> form.

Keys keep their spelling, so hyphenated keys map straight onto long options, and flags follow the mapping’s iteration order.

Parameters:

table (Mapping[str, Any]) – The configuration keys and values, like a parsed [tool.X] section.

Return type:

list[str]

Returns:

The equivalent list of --flag / --flag=value arguments.