pub fn is_key(input: &str) -> bool {
if input.as_bytes()[0usize] != b'-' {
return false;
}
if input.as_bytes()[1usize] != b'-' {
if input.len() != 2 {
return false;
}
return input.chars().nth(1).unwrap().is_alphabetic();
}
return input[2..].chars().all(|c| c.is_alphanumeric());
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_alphanumeric() {
let key = "--key";
assert_eq!(is_key(key), true);
}
}