Skip to main content

apply_defaults

Function apply_defaults 

Source
pub fn apply_defaults(command: Command) -> Command
Available on crate feature cli only.
Expand description

Apply ctl-core’s parser rules to a Clap command and return it.

-h/--help, the help subcommand, and -V/--version stay on. Repeated flags take the last value (args_override_self), and chassis_warnings still reports the clash. App applies it to every run, so a CLI calls it only to parse a command itself.

ctl-core declares -h/--help and help on every command, as Clap does with its help feature. A CLI that parses the result itself calls help::try_emit first: the derive’s from_arg_matches does not know the help subcommand.

§Panics

Panics if command disabled the help or version flag. ctl-core owns -h/--help and -V/--version, so the CLI never turns them off.