Skip to main content

Module command

Module command 

Source

Structs§

ArgSpec
Metadata for a single command argument.
CommandMeta
Complete metadata for a command.
Example
An executable example for a command.
FlagSpec
Metadata for a single flag.

Enums§

ArgType
Closed vocabulary for argument value types: every variant names a type explicitly present in the app, so the reference table never lists a type that does not exist. Shapes ($var targets, KEY=value pairs) are not types: the central validator only checks value types and arity, while each command’s lower enforces its own shapes with command-specific errors. ArgType::Any is the single exception: it renders as <any>, visibly a placeholder rather than a type name. ArgType::OneOf renders its inline options, likewise self-describing.
CheckOutcome
Lower-time checking outcome for one positional arg.
FlagValueType
Type of value a flag accepts.
IoDirection
Data direction for an argument.
Stream
Stream type for fallback or default output.

Traits§

CommandSpec
Trait for command metadata and lowering. No execution types.

Functions§

format_duration
Canonical display for a duration: largest exact unit (500ms, 10s, 2m, 1h), falling back to milliseconds. Round-trips through parse_duration.
parse_duration
Parse a TIMEOUT duration token (500ms, 10s, 2m, 1h; a bare number means seconds).
split_assignment
Single-token KEY=value split for direct lower_command callers and exotic keys the grammar cannot classify (single tokens only — no whitespace reassembly, so the quoted-space corruption class cannot arise here). Returns Ok(None) when there is no =.
strip_surrounding_quotes
Strip one layer of surrounding " or ' quotes (both kinds, everywhere).
validate_positionals_against_meta
Validate positional args against a command’s declared specs. Missing required positionals, statically-known type violations, and trailing positionals beyond a fixed-arity spec all fail here; templates, variables, and fragments defer to the runtime resolvers. A trailing Rest spec absorbs any number of positionals.