pub struct ArgWrap<'a> { /* private fields */ }
Expand description
Wrapper of Arg
to deserialize with DeserializeSeed
.
Methods from Deref<Target = Arg<'a>>§
Sourcepub fn is_set(&self, s: ArgSettings) -> bool
pub fn is_set(&self, s: ArgSettings) -> bool
Check if the ArgSettings
variant is currently set on the argument.
Sourcepub fn get_name(&self) -> &'help str
pub fn get_name(&self) -> &'help str
Deprecated, replaced with Arg::get_id
Sourcepub fn get_long_help(&self) -> Option<&'help str>
pub fn get_long_help(&self) -> Option<&'help str>
Get the long help specified for this argument, if any
§Examples
let arg = Arg::new("foo").long_help("long help");
assert_eq!(Some("long help"), arg.get_long_help());
Sourcepub fn get_help_heading(&self) -> Option<&'help str>
pub fn get_help_heading(&self) -> Option<&'help str>
Get the help heading specified for this argument, if any
Sourcepub fn get_visible_short_aliases(&self) -> Option<Vec<char>>
pub fn get_visible_short_aliases(&self) -> Option<Vec<char>>
Get visible short aliases for this argument, if any
Sourcepub fn get_all_short_aliases(&self) -> Option<Vec<char>>
pub fn get_all_short_aliases(&self) -> Option<Vec<char>>
Get all short aliases for this argument, if any, both visible and hidden.
Sourcepub fn get_short_and_visible_aliases(&self) -> Option<Vec<char>>
pub fn get_short_and_visible_aliases(&self) -> Option<Vec<char>>
Get the short option name and its visible aliases, if any
Sourcepub fn get_long(&self) -> Option<&'help str>
pub fn get_long(&self) -> Option<&'help str>
Get the long option name for this argument, if any
Sourcepub fn get_visible_aliases(&self) -> Option<Vec<&'help str>>
pub fn get_visible_aliases(&self) -> Option<Vec<&'help str>>
Get visible aliases for this argument, if any
Sourcepub fn get_all_aliases(&self) -> Option<Vec<&'help str>>
pub fn get_all_aliases(&self) -> Option<Vec<&'help str>>
Get all aliases for this argument, if any, both visible and hidden.
Sourcepub fn get_long_and_visible_aliases(&self) -> Option<Vec<&'help str>>
pub fn get_long_and_visible_aliases(&self) -> Option<Vec<&'help str>>
Get the long option name and its visible aliases, if any
Sourcepub fn get_possible_values(&self) -> Option<&[PossibleValue<'help>]>
pub fn get_possible_values(&self) -> Option<&[PossibleValue<'help>]>
Deprecated, replaced with [Arg::get_value_parser().possible_values()
]
Sourcepub fn get_value_names(&self) -> Option<&[&'help str]>
pub fn get_value_names(&self) -> Option<&[&'help str]>
Get the names of values for this argument.
Sourcepub fn get_num_vals(&self) -> Option<usize>
pub fn get_num_vals(&self) -> Option<usize>
Get the number of values for this argument.
Sourcepub fn get_value_delimiter(&self) -> Option<char>
pub fn get_value_delimiter(&self) -> Option<char>
Get the delimiter between multiple values
Sourcepub fn get_value_hint(&self) -> ValueHint
pub fn get_value_hint(&self) -> ValueHint
Get the value hint of this argument
Sourcepub fn get_global(&self) -> bool
pub fn get_global(&self) -> bool
Deprecated, replaced with Arg::is_global_set
Sourcepub fn get_env(&self) -> Option<&OsStr>
pub fn get_env(&self) -> Option<&OsStr>
Get the environment variable name specified for this argument, if any
§Examples
let arg = Arg::new("foo").env("ENVIRONMENT");
assert_eq!(Some(OsStr::new("ENVIRONMENT")), arg.get_env());
Sourcepub fn get_default_values(&self) -> &[&OsStr]
pub fn get_default_values(&self) -> &[&OsStr]
Get the default values specified for this argument, if any
§Examples
let arg = Arg::new("foo").default_value("default value");
assert_eq!(&["default value"], arg.get_default_values());
Sourcepub fn is_positional(&self) -> bool
pub fn is_positional(&self) -> bool
Checks whether this argument is a positional or not.
§Examples
let arg = Arg::new("foo");
assert_eq!(true, arg.is_positional());
let arg = Arg::new("foo").long("foo");
assert_eq!(false, arg.is_positional());
Sourcepub fn is_required_set(&self) -> bool
pub fn is_required_set(&self) -> bool
Reports whether Arg::required
is set
Sourcepub fn is_multiple_values_set(&self) -> bool
pub fn is_multiple_values_set(&self) -> bool
Report whether Arg::multiple_values
is set
Sourcepub fn is_multiple_occurrences_set(&self) -> bool
pub fn is_multiple_occurrences_set(&self) -> bool
Arg::multiple_occurrences
is going away (Issue #3772)
Sourcepub fn is_takes_value_set(&self) -> bool
pub fn is_takes_value_set(&self) -> bool
Report whether Arg::is_takes_value_set
is set
Sourcepub fn is_allow_hyphen_values_set(&self) -> bool
pub fn is_allow_hyphen_values_set(&self) -> bool
Report whether Arg::allow_hyphen_values
is set
Sourcepub fn is_forbid_empty_values_set(&self) -> bool
pub fn is_forbid_empty_values_set(&self) -> bool
Deprecated, replaced with Arg::get_value_parser()
Sourcepub fn is_allow_invalid_utf8_set(&self) -> bool
pub fn is_allow_invalid_utf8_set(&self) -> bool
Deprecated, replaced with [Arg::get_value_parser()
Sourcepub fn get_action(&self) -> &ArgAction
pub fn get_action(&self) -> &ArgAction
Behavior when parsing the argument
Sourcepub fn get_value_parser(&self) -> &ValueParser
pub fn get_value_parser(&self) -> &ValueParser
Configured parser for argument values
§Example
let cmd = clap::Command::new("raw")
.arg(
clap::Arg::new("port")
.value_parser(clap::value_parser!(usize))
);
let value_parser = cmd.get_arguments()
.find(|a| a.get_id() == "port").unwrap()
.get_value_parser();
println!("{:?}", value_parser);
Sourcepub fn is_global_set(&self) -> bool
pub fn is_global_set(&self) -> bool
Report whether Arg::global
is set
Sourcepub fn is_next_line_help_set(&self) -> bool
pub fn is_next_line_help_set(&self) -> bool
Report whether Arg::next_line_help
is set
Sourcepub fn is_hide_set(&self) -> bool
pub fn is_hide_set(&self) -> bool
Report whether Arg::hide
is set
Sourcepub fn is_hide_default_value_set(&self) -> bool
pub fn is_hide_default_value_set(&self) -> bool
Report whether Arg::hide_default_value
is set
Sourcepub fn is_hide_possible_values_set(&self) -> bool
pub fn is_hide_possible_values_set(&self) -> bool
Report whether Arg::hide_possible_values
is set
Sourcepub fn is_hide_env_set(&self) -> bool
pub fn is_hide_env_set(&self) -> bool
Report whether Arg::hide_env
is set
Sourcepub fn is_hide_env_values_set(&self) -> bool
pub fn is_hide_env_values_set(&self) -> bool
Report whether Arg::hide_env_values
is set
Sourcepub fn is_hide_short_help_set(&self) -> bool
pub fn is_hide_short_help_set(&self) -> bool
Report whether Arg::hide_short_help
is set
Sourcepub fn is_hide_long_help_set(&self) -> bool
pub fn is_hide_long_help_set(&self) -> bool
Report whether Arg::hide_long_help
is set
Sourcepub fn is_use_value_delimiter_set(&self) -> bool
pub fn is_use_value_delimiter_set(&self) -> bool
Report whether Arg::use_value_delimiter
is set
Sourcepub fn is_require_value_delimiter_set(&self) -> bool
pub fn is_require_value_delimiter_set(&self) -> bool
Report whether Arg::require_value_delimiter
is set
Sourcepub fn is_require_equals_set(&self) -> bool
pub fn is_require_equals_set(&self) -> bool
Report whether Arg::require_equals
is set
Sourcepub fn is_exclusive_set(&self) -> bool
pub fn is_exclusive_set(&self) -> bool
Reports whether Arg::exclusive
is set
Sourcepub fn is_last_set(&self) -> bool
pub fn is_last_set(&self) -> bool
Reports whether Arg::last
is set
Sourcepub fn is_ignore_case_set(&self) -> bool
pub fn is_ignore_case_set(&self) -> bool
Reports whether Arg::ignore_case
is set