Skip to main content

cli_invocation_invalid_event

Function cli_invocation_invalid_event 

Source
pub fn cli_invocation_invalid_event(detail: &str) -> Event
Expand description

The standard event for a program that misread its own resolved invocation.

Dispatch itself cannot fail — [BoundCliSpec::resolve_from] binds the handler while resolving, so there is no undispatchable invocation to report. What remains is a handler reading an argument the selected combination does not supply: an id it does not declare, or one whose type does not match the accessor. [BoundCliSpec::call_every_combination] catches the first from a test; this is for a program that also wants to say something at runtime.

It is a defect in the program, never in what the user typed, and the code and exit status have to say so. Reporting it as a usage error tells the caller to fix their command line and retry, and retrying cannot help — a mistake that has already been made in the wild, as cli_invalid_argument_value at exit 2. Emit this and exit 1; the application still owns the exit.