Struct bdrck_params::option::Option
[−]
[src]
pub struct Option { pub name: String, pub help: String, pub short_name: Optional<char>, pub default_value: Optional<String>, pub is_optional: bool, pub is_flag: bool, }
An option is a non-positional parameter to a command. Options can either be normal options or flags. Normal options must be passed by name along with a value. Flags are options whose value is either true or false, and is false by default. Passing a flag by name means flipping its value to true.
Fields
name: String
help: String
short_name: Optional<char>
default_value: Optional<String>
is_optional: bool
is_flag: bool
Methods
impl Option
[src]
fn required(name: &str,
help: &str,
short_name: Optional<char>,
default_value: Optional<&str>)
-> Option
help: &str,
short_name: Optional<char>,
default_value: Optional<&str>)
-> Option
Constructs a required option. This option may have a default value. But, importantly, it will always have some value inside the command function.
fn optional(name: &str, help: &str, short_name: Optional<char>) -> Option
Construct an optional value. This option does not have a default value, and it may have no value to access inside the command function.
fn flag(name: &str, help: &str, short_name: Optional<char>) -> Option
Construct a flag option. This option's value is either true or false, and it is false unless it is explicitly passed to the command as an argument.
Trait Implementations
impl Clone for Option
[src]
fn clone(&self) -> Option
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more