Struct easy_args::ArgSpec [−][src]
pub struct ArgSpec { /* fields omitted */ }
Expand description
Specifies the valid arguments of the program and is used to parse
the command-line arguments into an [Arg
].
Implementations
Creates an ArgSpecBuilder
that can be used to build the ArgSpec
.
Example
use easy_args::ArgSpec; let spec = ArgSpec::build() .boolean("arg1") .done() .unwrap();
Determines if an argument of a given name and ArgType
exists
within the ArgSpec
.
Example
use easy_args::{arg_spec, ArgType}; let spec = arg_spec!(username: String); if spec.has_arg("username", ArgType::String) { let args = spec.parse().unwrap(); if let Some(username) = args.string("username") { // do something with username } }
Parses the command-line arguments and Returns [Ok(Args)
] if there
were no parse errors and [Err(Error)
] if otherwise.
Example
use easy_args::arg_spec; let spec = arg_spec!(vsync: bool); match spec.parse() { Ok(args) => { // do stuff with the arguments } Err(err) => eprintln!("{:?}", err), }
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ArgSpec
impl UnwindSafe for ArgSpec