Skip to main content

params_from_clap

Function params_from_clap 

Source
pub fn params_from_clap(cmd: &Command) -> Vec<ParamSchema>
Expand description

Reflect each Arg in a clap Command into a ParamSchema.

Skips:

  • --help / -h (auto-injected by clap)
  • --version / -V (auto-injected by clap when version is set)
  • --json (kernel-owned global flag)
  • Hidden flag args (#[arg(hide = true)] without an index) — true internal helpers.

Hidden positional args are kept: many migrated builtins use #[arg(hide = true)] paths: Vec<String> purely so clap accepts the ---terminated positional tail emitted by ToolArgs::to_argv(). Those positionals ARE the tool’s public surface (cat paths…, mkdir paths…), so they belong in the schema with a positional: true marker and ride the field’s doc-comment for the description.