feat: entry search
This commit is contained in:
parent
8e6fa9be2f
commit
7c86e3d496
2 changed files with 130 additions and 82 deletions
11
src/db.rs
11
src/db.rs
|
|
@ -27,6 +27,17 @@ impl BasicField {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait EntrySearchExt {
|
||||
fn contains(&self, s: impl AsRef<str>) -> bool;
|
||||
}
|
||||
impl EntrySearchExt for keepass::db::EntryRef<'_> {
|
||||
fn contains(&self, s: impl AsRef<str>) -> bool {
|
||||
let str = s.as_ref();
|
||||
self.get_title().is_some_and(|title| title.contains(str))
|
||||
|| self.get_url().is_some_and(|url| url.contains(str))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_last_opened() -> io::Result<String> {
|
||||
Ok(fs::read_to_string(
|
||||
dirs::data_dir()
|
||||
|
|
|
|||
Loading…
Reference in a new issue