[−][src]Function go_flag::parse
pub fn parse<'a, T, F>(f: F) -> Vec<T> where
T: FlagValue,
F: FnOnce(&mut FlagSet<'a>),
Parses the command-line arguments into flags.
Flags are registered in the given closure.
Returns
Returns the list of positional arguments (remaining arguments).
Positional arguments can also be parsed. You'll typically need
Vec<String>
, Vec<OsString>
or Vec<PathBuf>
.
Exits
It exits if the command-line arguments contain invalid flags.
Outputs
It prints errors and warnings to the standard error stream (stderr).
Example
let mut force = false; let mut lines = 10_i32; let args: Vec<String> = go_flag::parse(|flags| { flags.add_flag("f", &mut force); flags.add_flag("lines", &mut lines); });