@@ -61,7 +61,7 @@ class SettingsConfigDict(ConfigDict, total=False):
6161 cli_exit_on_error : bool
6262 cli_prefix : str
6363 cli_flag_prefix_char : str
64- cli_implicit_flags : bool | None
64+ cli_implicit_flags : bool | Literal [ 'dual' , 'toggle' ] | None
6565 cli_ignore_unknown_args : bool | None
6666 cli_kebab_case : bool | Literal ['all' , 'no_enums' ] | None
6767 cli_shortcuts : Mapping [str , str | list [str ]] | None
@@ -153,8 +153,12 @@ class BaseSettings(BaseModel):
153153 Defaults to `True`.
154154 _cli_prefix: The root parser command line arguments prefix. Defaults to "".
155155 _cli_flag_prefix_char: The flag prefix character to use for CLI optional arguments. Defaults to '-'.
156- _cli_implicit_flags: Whether `bool` fields should be implicitly converted into CLI boolean flags.
157- (e.g. --flag, --no-flag). Defaults to `False`.
156+ _cli_implicit_flags: Controls how `bool` fields are exposed as CLI flags.
157+
158+ - False (default): no implicit flags are generated; booleans must be set explicitly (e.g. --flag=true).
159+ - True / 'dual': optional boolean fields generate both positive and negative forms (--flag and --no-flag).
160+ - 'toggle': required boolean fields remain in 'dual' mode, while optional boolean fields generate a single
161+ flag aligned with the default value (if default=False, expose --flag; if default=True, expose --no-flag).
158162 _cli_ignore_unknown_args: Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`.
159163 _cli_kebab_case: CLI args use kebab case. Defaults to `False`.
160164 _cli_shortcuts: Mapping of target field name to alias names. Defaults to `None`.
@@ -184,7 +188,7 @@ def __init__(
184188 _cli_exit_on_error : bool | None = None ,
185189 _cli_prefix : str | None = None ,
186190 _cli_flag_prefix_char : str | None = None ,
187- _cli_implicit_flags : bool | None = None ,
191+ _cli_implicit_flags : bool | Literal [ 'dual' , 'toggle' ] | None = None ,
188192 _cli_ignore_unknown_args : bool | None = None ,
189193 _cli_kebab_case : bool | Literal ['all' , 'no_enums' ] | None = None ,
190194 _cli_shortcuts : Mapping [str , str | list [str ]] | None = None ,
@@ -271,7 +275,7 @@ def _settings_build_values(
271275 _cli_exit_on_error : bool | None = None ,
272276 _cli_prefix : str | None = None ,
273277 _cli_flag_prefix_char : str | None = None ,
274- _cli_implicit_flags : bool | None = None ,
278+ _cli_implicit_flags : bool | Literal [ 'dual' , 'toggle' ] | None = None ,
275279 _cli_ignore_unknown_args : bool | None = None ,
276280 _cli_kebab_case : bool | Literal ['all' , 'no_enums' ] | None = None ,
277281 _cli_shortcuts : Mapping [str , str | list [str ]] | None = None ,
0 commit comments