Add support for the camel case mode, instead of regular mode.
This commit is contained in:
+15
-1
@@ -48,10 +48,11 @@ peg::parser! {
|
||||
_ => Err("unknown mode"),
|
||||
}
|
||||
}
|
||||
rule rmode() -> Mode = m:$("R" / "r" / "U" / "u" / "N" / "n" / "H" / "h" / "B" / "b" / "D" / "d") {?
|
||||
rule rmode() -> Mode = m:$("R" / "r" / "U" / "u" / "N" / "n" / "C" / "H" / "h" / "B" / "b" / "D" / "d") {?
|
||||
match m.to_uppercase().as_str() {
|
||||
"R" => Ok(Mode::Regular),
|
||||
"N" => Ok(Mode::NoSpace),
|
||||
"C" => Ok(Mode::NoSpaceCamel),
|
||||
"U" => Ok(Mode::RegularUpcase),
|
||||
"H" => Ok(Mode::Hex),
|
||||
"B" => Ok(Mode::Base64),
|
||||
@@ -233,6 +234,19 @@ mod tests {
|
||||
comment: Some("a b c".to_string())
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
command_parser::name("ableton89 20C 98 2020-12-09 a b c"),
|
||||
Ok(Password {
|
||||
name: Rc::new("ableton89".to_string()),
|
||||
parent: None,
|
||||
prefix: None,
|
||||
mode: Mode::NoSpaceCamel,
|
||||
length: Some(20),
|
||||
seq: 98,
|
||||
date: NaiveDate::from_ymd_opt(2020, 12, 09).unwrap(),
|
||||
comment: Some("a b c".to_string())
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
command_parser::name("ableton89 20D 2020-12-09 a b c"),
|
||||
Ok(Password {
|
||||
|
||||
Reference in New Issue
Block a user