#[non_exhaustive]pub struct ArgInfo {Show 18 fields
pub id: &'static str,
pub kind: ArgKind,
pub short: Option<char>,
pub long: Option<&'static str>,
pub visible_short_aliases: &'static [char],
pub short_aliases: &'static [char],
pub visible_aliases: &'static [&'static str],
pub aliases: &'static [&'static str],
pub value_name: &'static str,
pub help: &'static str,
pub long_help: &'static str,
pub possible_values: &'static [&'static str],
pub env: Option<&'static str>,
pub hidden: bool,
pub required: bool,
pub multiple: bool,
pub last: bool,
pub global: bool,
}Expand description
The description of one argument.
Values are built with ArgInfo::new and the const builder methods, so that fields can be
added without breaking existing code.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: &'static strThe name of the field, or help and version for the generated flags.
kind: ArgKindHow the argument is given.
short: Option<char>The short name, without the leading -.
long: Option<&'static str>The long name, without the leading --.
visible_short_aliases: &'static [char]The short aliases listed in the help.
short_aliases: &'static [char]The short aliases hidden from the help.
visible_aliases: &'static [&'static str]The long aliases listed in the help.
aliases: &'static [&'static str]The long aliases hidden from the help.
value_name: &'static strThe name of the value, e.g. FILE. Empty for flags.
help: &'static strThe short help. Empty when not set.
long_help: &'static strThe long help. Empty when not set.
possible_values: &'static [&'static str]The accepted values, from possible_values or a ValueEnum. Empty
when any value is accepted.
env: Option<&'static str>The environment variable the argument falls back to.
Whether the argument is hidden from the help.
required: boolWhether the argument must be given.
multiple: boolWhether the argument can be given several times, e.g. a Count flag or a field collecting
repeated values. A repeatable positional argument takes every
remaining positional argument.
last: boolWhether the positional argument is only filled after --.
global: boolWhether the option is global: also accepted after the subcommands of its command, and
listed in their help and completions.
Implementations§
Source§impl ArgInfo
impl ArgInfo
Sourcepub const fn new(id: &'static str, kind: ArgKind) -> Self
pub const fn new(id: &'static str, kind: ArgKind) -> Self
An argument named id, without names, help or values.
Sourcepub const fn visible_short_aliases(self, aliases: &'static [char]) -> Self
pub const fn visible_short_aliases(self, aliases: &'static [char]) -> Self
Sets visible_short_aliases.
Sourcepub const fn short_aliases(self, aliases: &'static [char]) -> Self
pub const fn short_aliases(self, aliases: &'static [char]) -> Self
Sets short_aliases.
Sourcepub const fn visible_aliases(self, aliases: &'static [&'static str]) -> Self
pub const fn visible_aliases(self, aliases: &'static [&'static str]) -> Self
Sets visible_aliases.
Sourcepub const fn value_name(self, value_name: &'static str) -> Self
pub const fn value_name(self, value_name: &'static str) -> Self
Sets value_name.
Sourcepub const fn possible_values(self, values: &'static [&'static str]) -> Self
pub const fn possible_values(self, values: &'static [&'static str]) -> Self
Sets possible_values.
Sets hidden.
Sourcepub const fn takes_value(&self) -> bool
pub const fn takes_value(&self) -> bool
Whether the argument takes a value: options and positional arguments.
Sourcepub const fn is_positional(&self) -> bool
pub const fn is_positional(&self) -> bool
Whether the argument is positional.
Sourcepub const fn long_or_short_help(&self) -> &'static str
pub const fn long_or_short_help(&self) -> &'static str
The long help, or the short help when there is no long help.