Function yash_env::option::parse_long

source ยท
pub fn parse_long(name: &str) -> Result<(Option, State), FromStrError>
Expand description

Parses a long option name.

This function is similar to impl FromStr for Option, but allows prefixing the option name with no to negate the state.

assert_eq!(parse_long("notify"), Ok((Notify, On)));
assert_eq!(parse_long("nonotify"), Ok((Notify, Off)));
assert_eq!(parse_long("tify"), Err(NoSuchOption));

Note that new options may be added in the future, which can turn an unambiguous option name into an ambiguous one. You should use full option names for forward compatibility.

You cannot parse a short option name with this function. Use parse_short for that purpose.