Skip to main content

handle_machine_clap_error

Function handle_machine_clap_error 

Source
fn handle_machine_clap_error(err: Error) -> !
Expand description

Convert a clap error into a structured machine-mode envelope and exit.

  • DisplayHelp / DisplayVersion (explicit --help / --version) → success envelope wrapping clap’s already-rendered, context-aware text (so e.g. cast call --help yields cast call help, not root help), exit 0.
  • Everything else (parse errors, missing subcommand, missing required arg, conflict, including DisplayHelpOnMissingArgumentOrSubcommand, which is clap’s “render help because args were missing” — i.e. a usage failure, not a help request) → error envelope with cli.usage.invalid, exit 2.