MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / kind_slug

Function kind_slug

atomic-cli/src/agent_error.rs:28–49  ·  view source on GitHub ↗

Stable machine slug for the `error:` key. Derived from [`ErrorKind`], NOT scraped from clap's English prose, so it survives clap rewording its messages.

(kind: ErrorKind)

Source from the content-addressed store, hash-verified

26/// Derived from [`ErrorKind`], NOT scraped from clap's English prose, so it
27/// survives clap rewording its messages.
28pub fn kind_slug(kind: ErrorKind) -> &'static str {
29 match kind {
30 ErrorKind::InvalidValue => "invalid-value",
31 ErrorKind::UnknownArgument => "unknown-arg",
32 ErrorKind::InvalidSubcommand => "unknown-subcommand",
33 ErrorKind::NoEquals => "missing-equals",
34 ErrorKind::ValueValidation => "invalid-value",
35 ErrorKind::TooManyValues => "too-many-values",
36 ErrorKind::TooFewValues => "too-few-values",
37 ErrorKind::WrongNumberOfValues => "wrong-number-of-values",
38 ErrorKind::ArgumentConflict => "conflicting-args",
39 ErrorKind::MissingRequiredArgument => "missing-required-arg",
40 ErrorKind::MissingSubcommand => "missing-subcommand",
41 ErrorKind::InvalidUtf8 => "invalid-utf8",
42 ErrorKind::DisplayHelp
43 | ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand
44 | ErrorKind::DisplayVersion => "display",
45 ErrorKind::Io => "io",
46 ErrorKind::Format => "format",
47 _ => "usage-error",
48 }
49}
50
51/// The command path clap itself scoped the error to, read out of its usage line.
52///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected