diff --git a/Cargo.lock b/Cargo.lock index daa4dc3..641e82e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -560,7 +560,7 @@ dependencies = [ [[package]] name = "royalguard" -version = "0.3.0" +version = "0.3.1" dependencies = [ "aes-gcm", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index ea3f5c4..d7bddb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "royalguard" -version = "0.3.0" +version = "0.3.1" edition = "2021" authors = ["Zahash "] description = "Ergonomic Command Line Password Manager. Forever Free." diff --git a/src/eval.rs b/src/eval.rs index ff93238..3518220 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -189,7 +189,7 @@ impl<'text> Cond<'text> for Filter<'text> { impl<'text> Cond<'text> for Contains<'text> { fn test(&self, data: &Data) -> bool { match self.attr { - "$name" => data.name.contains(self.substr), + "$name" | "." => data.name.contains(self.substr), attr => data .fields .get(attr) @@ -201,7 +201,7 @@ impl<'text> Cond<'text> for Contains<'text> { impl<'text> Cond<'text> for Matches<'text> { fn test(&self, data: &Data) -> bool { match self.attr { - "$name" => self.pat.find(&data.name).is_some(), + "$name" | "." => self.pat.find(&data.name).is_some(), attr => data .fields .get(attr) @@ -214,7 +214,7 @@ impl<'text> Cond<'text> for Matches<'text> { impl<'text> Cond<'text> for Is<'text> { fn test(&self, data: &Data) -> bool { match self.attr { - "$name" => data.name == self.value, + "$name" | "." => data.name == self.value, attr => data.fields.get(attr).map_or(false, |val| val == self.value), } } @@ -398,6 +398,11 @@ mod tests { "show $name is sus", ["'sus' name='potatus' user='sussolini'"] ); + check!( + &mut state, + "show . is sus", + ["'sus' name='potatus' user='sussolini'"] + ); check!( &mut state, "show name is potatus", diff --git a/src/prompt.rs b/src/prompt.rs index 64d206a..9658200 100644 --- a/src/prompt.rs +++ b/src/prompt.rs @@ -14,12 +14,19 @@ const LOGO: &'static str = r#" "#; const HELP: &'static str = r#" -set gmail user = sussolini pass = 'use single quote for spaces' url = mail.google.sus -set gmail pass = updatedpassword -del gmail -show all -show gmail -show user is sussolini and (pass contains sus or url matches '.*com') +Add, Update and Delete: + set gmail user = sussolini pass = 'use single quote for spaces' url = mail.google.sus + set gmail pass = updatedpassword + del gmail + +Show: + show all + show gmail + show user is sussolini and (pass contains sus or url matches '.*com') + +Show (filter by name): + show $name contains mail + show . contains mail "#; /// Royal Guard