pub struct FlagMeta<'a> {Show 24 fields
pub flag: &'a Flag<'a>,
pub builtin: bool,
pub help: Option<&'a str>,
pub long_help: Option<&'a str>,
pub value_name: Option<&'a str>,
pub env: Option<&'a str>,
pub default: &'a [&'a str],
pub accepted_choices: &'a [&'a str],
pub choices: &'a [&'a str],
pub ignore_case: bool,
pub allow_unknown_choices: bool,
pub required: bool,
pub value_optional: bool,
pub hide: bool,
pub hide_default_value: bool,
pub hide_env: bool,
pub hide_possible_values: bool,
pub hide_short_help: bool,
pub hide_long_help: bool,
pub count: bool,
pub complete: Option<fn(&CompleteCtx<'_>) -> Vec<Candidate<'static>>>,
pub repeatable: bool,
pub help_heading: Option<&'a str>,
pub extra: &'a FlagExtra<'a>,
}Expand description
What a flag knows about itself beyond how it parses.
Fields§
§flag: &'a Flag<'a>§builtin: boolA parser-supplied public entry point materialized in an exported spec.
It belongs in flag listings and completions, but not in the command synopsis where the runtime’s implicit help and version flags have never appeared.
help: Option<&'a str>Short help, shown by -h.
long_help: Option<&'a str>Long help, shown by --help.
value_name: Option<&'a str>The placeholder for the flag’s value, such as n in --jobs <n>.
env: Option<&'a str>§default: &'a [&'a str]§accepted_choices: &'a [&'a str]Canonical choices plus aliases accepted by the value type.
choices: &'a [&'a str]§ignore_case: bool§allow_unknown_choices: boolAccept values outside choices while retaining the list for help and completion.
required: bool§value_optional: boolWhether the flag’s value may be left off, as in --bump or --bump 5.
Help only, and deliberately: usage-lib’s parser refuses a bare --bump exactly as it
refuses a bare --port, so this changes no binding — it changes the brackets, [BUMP]
rather than <BUMP>, which is what a spec’s arg "[BUMP]" required=#false says. In
FlagMeta and not in Flag for that reason: a parse never reads it.
hide: bool§hide_default_value: bool§hide_env: bool§hide_possible_values: bool§hide_short_help: bool§hide_long_help: bool§count: boolWhether repetition is counted rather than collected, as in -vvv.
complete: Option<fn(&CompleteCtx<'_>) -> Vec<Candidate<'static>>>What answers for this flag’s value when a shell asks.
The Rust counterpart of a spec’s run=: it is written into the emitted KDL as a command
that asks this binary, so a spec stays complete for every other consumer while the
binary answers itself.
repeatable: boolWhether the flag may be given more than once. Distinct from
Flag::variadic, which is one occurrence taking several values.
help_heading: Option<&'a str>Heading to list this flag under in help output. Presentational: it groups a long flag list into sections and changes nothing about parsing.
extra: &'a FlagExtra<'a>Everything a flag rarely declares: relations to other flags, deprecation, validation,
bounds, and spec-only metadata. Shared through NO_FLAG_EXTRA by every flag that
declares none of it, so a table pays for these fields once rather than per flag.