[−][src]Struct flaggy::spec::Spec
Spec describes a flag, in such a way that the parser can correctly identify it in the set of arguments given on the command-line.
Methods
impl Spec
[src]
pub fn required(
name: &str,
help: &str,
short_name: Option<char>,
default_value: Option<&str>
) -> Spec
[src]
name: &str,
help: &str,
short_name: Option<char>,
default_value: Option<&str>
) -> Spec
Constructs a Spec which describes a required named flag. This flag may have a default value, but the key point is that it must have some value after parsing is complete.
pub fn optional(name: &str, help: &str, short_name: Option<char>) -> Spec
[src]
Constructs a Spec which describes an optional named flag. This flag may not have a value after we are finished parsing.
pub fn boolean(name: &str, help: &str, short_name: Option<char>) -> Spec
[src]
Constructs a Spec which describes a boolean named flag. Flags of this type always have a value, and that value is either true or false, instead of being a freeform string like other flag types.
If this flag is not specified at all on the command line, its "default value" is false.
pub fn positional(
name: &str,
help: &str,
default_value: Option<&[&str]>,
is_variadic: bool
) -> Result<Spec>
[src]
name: &str,
help: &str,
default_value: Option<&[&str]>,
is_variadic: bool
) -> Result<Spec>
Constructs a Spec which describes a positional flag. Flags of this type are not looked up by name after a "-" or "--" character, but instead are parsed purely by their position in the list of command-line arguments.
This also means that the order in which positional flags are added to a Specs structure matters for parsing.
A positional flag is variadic if it should be able to collect more than one value (e.g., for a command which takes a list of files to process of unspecified length).
pub fn get_name(&self) -> &str
[src]
Returns this flag's full name (i.e., not the short name).
pub fn get_help(&self) -> &str
[src]
Returns the human-readable help text for this flag.
pub fn get_short_name(&self) -> Option<char>
[src]
Returns this flag's short name, if it has one.
Trait Implementations
impl Clone for Spec
[src]
fn clone(&self) -> Spec
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Spec
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,