Expand description
Cold-path metadata, and writing it out as a spec.
The tables in the crate root are what a parse reads: names, shorts, whether a flag takes a value. Everything else a CLI knows about itself — help text, choices, defaults, what a command does to the world — lives here instead, in a parallel tree that points at those tables.
Two reasons for the split. A successful parse never touches any of this, so
keeping it out of the hot tables keeps them dense; and a CLI that wants only a
parser does not compile it at all, since this module is behind the spec
feature.
What the metadata does not do is repeat the tables. FlagMeta borrows the
Flag it describes, so long and short forms have exactly one definition and
cannot drift from what the parser matches.
§Emitting
Everything here lowers into the spec without loss, which is deliberate: a
field the spec cannot express would make the emitted KDL a summary rather than
a definition. When something is missing the spec gains it first —
help_heading went in that way.
Structs§
- ArgMeta
- What a positional argument knows about itself beyond how it parses.
- Argument
State - Presence information exposed across a flattened
CommandArgsboundary. - Candidate
- Something a shell could offer at the cursor.
- Choice
Alias Meta - Choice
Meta - Command
Meta - What a command knows about itself beyond how it parses.
- Command
Overlay - One sparse metadata override applied by
SpecView. - Complete
Ctx - What a completion callback is told about the cursor.
- Default
If - A default that applies when another flag is given.
- Default
View Omitter - The omission policy used by generated executable-view entry points.
- Example
- A worked example, for documentation.
- Flag
Meta - What a flag knows about itself beyond how it parses.
- Flatten
Group - A run of one command’s flags that arrived from a flattened
Argstype. - Group
Meta - A set of one command’s arguments that relate to one another as a set.
- Required
IfEq - A selector/value comparison used by conditional requiredness.
- Requires
If - A flag required when the declaring flag is explicitly given
value. - Spec
- A whole CLI: the root command plus what describes the program itself.
- Spec
View - A borrowed, sparse view over a derive-generated
Spec. - View
Meta - A named executable surface emitted into the portable spec.
Enums§
- Command
Selector - A command selected for a cold-path metadata override.
- Effect
- What running a command does to the world.
- Setting
Given - One value a flag was given, in a vocabulary this crate can hold.
Traits§
- ArgGroup
- An enum whose variants are one command’s mutually exclusive switch flags.
- Command
Args - Omitted
- Supplies a typed placeholder for fields outside an executable view.
- Subcommands
- An enum whose variants are a command’s subcommands.
- Value
Enum - A struct that describes one command’s flags and arguments.
- View
Command Args - View-aware construction for a derived command or flattened argument group.
- View
Subcommands - View-aware construction for a derived subcommand enum.
Functions§
- choice_
matches - concat_
aliases - Join command alias lists at compile time.
- concat_
arg_ metas - Join groups of argument metadata into one, at compile time.
- concat_
bindings - The bindings of several commands, joined into one array.
- concat_
flag_ metas - Join groups of flag metadata into one, at compile time.
- concat_
group_ metas - Join groups of group metadata into one, at compile time.
- flag_
selector_ count - How many flags on
commandacceptselector. - view_
for_ program - The declared executable view selected by argv0, if any.
Type Aliases§
- Completer
- A function that answers for one argument or flag value.