macro_rules! get_val {
( $parser:ident, short, $tag:expr ) => { ... };
( $parser:ident, long, $tag:expr ) => { ... };
( $parser:ident, both, $short:expr, $long:expr ) => { ... };
}Expand description
Like get_arg!, but instead returns an option containing its ArgValue
Example:
use sarge::{arg, get_arg, get_val, Tag, ArgType, ArgValue, Argument, ArgumentParser};
let mut parser = ArgumentParser::new();
parser.add(arg!(flag, long, "help"));
parser.parse_args(vec!["abc".into(), "--help".into()]);
assert_eq!(get_val!(parser, long, "help").expect("Failed to get argument value"), ArgValue::Flag(true));