pub struct Opt {
pub id: String,
pub name: String,
pub value_required: bool,
pub value: Option<String>,
}Expand description
Structured option information.
This Opt struct represents organized information about single
command-line option. Instances of this struct are usually created by
OptSpecs struct’s getopt() method which returns an Args struct
which have these Opt structs inside.
A programmer may need these when examining parsed command-line
options. See the documentation of individual fields for more
information. Also see Args struct and its methods.
Fields§
§id: StringIdentifier for the option.
Identifiers are defined with OptSpecs struct’s option()
method before parsing command-line arguments. After getopt()
parsing the same identifier is copied here and it confirms that
the option was indeed given in the command line.
name: StringOption’s name in the parsed command line.
Option’s name that was used in the command line. For short options this is a single-character string. For long options the name has more than one characters.
value_required: boolThe option requires a value.
true means that the option was defined with value type
OptValueType::Required. See OptSpecs struct’s flag()
method for more information. This field does not guarantee that
there actually was a value for the option in the command line.
value: Option<String>Option’s value.
The value is a variant of enum Option. Value None means that
there is no value for the option. Value Some(String) provides
a value.