[−][src]Struct libcli::args::Config
Specifies a configuration of parsed arguments
Each option which was given as a spec can be accessed by option(name)
This returns a Option<Vec
Implementations
impl Config
[src]
Parses and generates configuration from supplied arguments and option specifications Can also generate usage strings
pub fn new_env(specs: &[OptionSpec]) -> Result<Config, String>
[src]
Same as Config::new but uses the arguments passed to the program (env::args)
The program path, first argument, is included in the unnamed args
Note, the spec isn't stored with config
pub fn new(args: &[&str], specs: &[OptionSpec]) -> Result<Config, String>
[src]
Parses config from custom supplied arguments
Specs is a list containing specifications for the available options a use can supply
Returns Err(msg) if a spec doesn't match what is specified
The arguments before any option are specified with the (unnamed)
The values for the options can be accessed with the option(name) method
Parsing will fail if an option with policy other than Exact(0) is used twice
Note, the spec isn't stored with config
pub fn generate_usage(
specs: &[OptionSpec],
list_required: bool,
list_unrequired: bool
) -> String
[src]
specs: &[OptionSpec],
list_required: bool,
list_unrequired: bool
) -> String
Generates a usage string from supplied specs
pub fn option(&self, name: &str) -> Option<&Vec<String>>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,