From 702a644f68c687142c9a03b48cf451665ed41b62 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 11 Sep 2022 16:24:16 +0100 Subject: better cursor search (#473) * improve cursor code * proper unicode support * refactor and test * fmt * clippy * move methods to state * refactor search modules --- atuin-client/src/database.rs | 2 +- atuin-client/src/settings.rs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'atuin-client/src') diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 7b3ab3be..ba28daf3 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -461,7 +461,7 @@ mod test { Some("beep boop".to_string()), Some("booop".to_string()), ); - return db.save(&history).await; + db.save(&history).await } #[tokio::test(flavor = "multi_thread")] diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index d8720574..f836ce02 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -27,16 +27,27 @@ pub enum SearchMode { #[derive(Clone, Debug, Deserialize, Copy, PartialEq, Eq)] pub enum FilterMode { #[serde(rename = "global")] - Global, + Global = 0, #[serde(rename = "host")] - Host, + Host = 1, #[serde(rename = "session")] - Session, + Session = 2, #[serde(rename = "directory")] - Directory, + Directory = 3, +} + +impl FilterMode { + pub fn as_str(&self) -> &'static str { + match self { + FilterMode::Global => "GLOBAL", + FilterMode::Host => "HOST", + FilterMode::Session => "SESSION", + FilterMode::Directory => "DIRECTORY", + } + } } // FIXME: Can use upstream Dialect enum if https://github.com/stevedonovan/chrono-english/pull/16 is merged -- cgit v1.3.1