aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-client')
-rw-r--r--atuin-client/src/settings.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs
index de9bd640..bbbd78ee 100644
--- a/atuin-client/src/settings.rs
+++ b/atuin-client/src/settings.rs
@@ -34,6 +34,32 @@ pub enum SearchMode {
Skim,
}
+impl SearchMode {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ SearchMode::Prefix => "PREFIX",
+ SearchMode::FullText => "FULLTXT",
+ SearchMode::Fuzzy => "FUZZY",
+ SearchMode::Skim => "SKIM",
+ }
+ }
+ pub fn next(&self, settings: &Settings) -> Self {
+ match self {
+ SearchMode::Prefix => SearchMode::FullText,
+ SearchMode::FullText => {
+ // if the user is using skim, we go to skim, otherwise fuzzy.
+ if settings.search_mode == SearchMode::Skim {
+ SearchMode::Skim
+ } else {
+ SearchMode::Fuzzy
+ }
+ }
+ SearchMode::Fuzzy => SearchMode::Prefix,
+ SearchMode::Skim => SearchMode::Prefix,
+ }
+ }
+}
+
#[derive(Clone, Debug, Deserialize, Copy, PartialEq, Eq, ValueEnum)]
pub enum FilterMode {
#[serde(rename = "global")]