pub struct FlagMeta<'a> {Show 58 fields
pub flag: &'a Flag<'a>,
pub builtin: bool,
pub display_order: Option<usize>,
pub hidden_shorts: &'a [u8],
pub hidden_longs: &'a [&'a str],
pub help: Option<&'a str>,
pub long_help: Option<&'a str>,
pub admonitions: &'a [AdmonitionMeta<'a>],
pub deprecated: Option<&'a str>,
pub deprecated_warn_at: Option<&'a str>,
pub deprecated_remove_at: Option<&'a str>,
pub value_name: Option<&'a str>,
pub value_names: &'a [&'a str],
pub env: Option<&'a str>,
pub env_fallback: &'a [&'a str],
pub deprecated_env: &'a [&'a str],
pub default: &'a [&'a str],
pub accepted_choices: &'a [&'a str],
pub choices: &'a [&'a str],
pub choice_aliases: &'a [(&'a str, &'a str)],
pub choice_details: &'a [ChoiceMeta<'a>],
pub ignore_case: bool,
pub allow_unknown_choices: bool,
pub validate: Option<&'a str>,
pub validate_error: Option<&'a str>,
pub required: bool,
pub value_optional: bool,
pub hide: bool,
pub hide_default_value: bool,
pub hide_env: bool,
pub hide_env_values: 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 complete_type: Option<&'a str>,
pub repeatable: bool,
pub var_min: Option<usize>,
pub var_max: Option<usize>,
pub value_var_min: Option<usize>,
pub value_var_max: Option<usize>,
pub overrides: &'a [&'a str],
pub conflicts: &'a [&'a str],
pub delimiter: Option<char>,
pub exclusive: bool,
pub requires: &'a [&'a str],
pub requires_if: &'a [RequiresIf<'a>],
pub default_if: &'a [DefaultIf<'a>],
pub required_if: &'a [&'a str],
pub required_if_eq: &'a [RequiredIfEq<'a>],
pub required_if_eq_all: &'a [RequiredIfEq<'a>],
pub required_unless: &'a [&'a str],
pub required_unless_all: &'a [&'a str],
pub help_heading: Option<&'a str>,
pub surface: Option<&'a str>,
pub available_if: &'a [&'a str],
pub effect: Option<Effect>,
}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.
display_order: Option<usize>Explicit placement within its help section.
Short forms accepted by the parser but omitted from help and completion.
Long forms accepted by the parser but omitted from help and completion.
help: Option<&'a str>Short help, shown by -h.
long_help: Option<&'a str>Long help, shown by --help.
admonitions: &'a [AdmonitionMeta<'a>]Notes and warnings shown after the extended help text.
deprecated: Option<&'a str>Why this flag is deprecated, plus optional release milestones.
deprecated_warn_at: Option<&'a str>§deprecated_remove_at: Option<&'a str>§value_name: Option<&'a str>The placeholder for the flag’s value, such as n in --jobs <n>.
value_names: &'a [&'a str]Ordered placeholders for one fixed-arity occurrence.
env: Option<&'a str>§env_fallback: &'a [&'a str]§deprecated_env: &'a [&'a str]§default: &'a [&'a str]§accepted_choices: &'a [&'a str]Canonical choices plus aliases accepted by the value type.
choices: &'a [&'a str]§choice_aliases: &'a [(&'a str, &'a str)]Canonical-to-alias pairs used when emitting a lossless spec.
choice_details: &'a [ChoiceMeta<'a>]Per-canonical presentation metadata used when emitting a lossless spec.
ignore_case: bool§allow_unknown_choices: boolAccept values outside choices while retaining the list for help and completion.
validate: Option<&'a str>Portable expr expression evaluated for each raw value.
validate_error: Option<&'a str>Message reported when validation returns false.
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_env_values: 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.
complete_type: Option<&'a str>A built-in completion class such as path or dir.
repeatable: boolWhether the flag may be given more than once. Distinct from
Flag::variadic, which is one occurrence taking several values.
var_min: Option<usize>§var_max: Option<usize>§value_var_min: Option<usize>Bounds on values consumed by one occurrence, distinct from the flag-level occurrence bounds above.
value_var_max: Option<usize>§overrides: &'a [&'a str]Flags this one displaces when both are given.
conflicts: &'a [&'a str]Flags that cannot be given alongside this one.
Where overrides resolves a collision by letting the last
flag win, this reports it: the combination has no meaning, so honouring one
side silently would hide a mistake.
delimiter: Option<char>The character one word is split on to make several values, as clap’s
value_delimiter does. Only ever set where several values can land.
exclusive: boolWhether this flag must be given on its own.
The whole-command form of conflicts: everything the command
declares counts, positionals included.
requires: &'a [&'a str]Flags that must also be given when this one is.
The positive form of conflicts, and the mirror image of
required_if: the same rule written on the flag that
imposes it rather than on the flag it lands on.
requires_if: &'a [RequiresIf<'a>]Value-triggered requirements declared by this flag.
default_if: &'a [DefaultIf<'a>]Defaults that apply when another flag is given.
required_if: &'a [&'a str]Flags that make this one necessary.
required_if_eq: &'a [RequiredIfEq<'a>]Selector/value conditions, any one of which makes this required.
required_if_eq_all: &'a [RequiredIfEq<'a>]Selector/value conditions which must all match to make this required.
required_unless: &'a [&'a str]Flags that make this one unnecessary.
required_unless_all: &'a [&'a str]All selectors must be present to make this unnecessary.
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.
surface: Option<&'a str>Named audience or compatibility surface this flag belongs to.
available_if: &'a [&'a str]Descriptive availability conditions; they do not affect parsing.
effect: Option<Effect>