From 508d4f476157384b0d454bee3dd6e9256560561b Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Fri, 22 Apr 2022 21:05:02 +0100 Subject: History filter (#329) * Add history filters, and hotkey toggle Switch between different search modes to narrow down the history you want - global search for all history, host for all history from your current machine, session for the current shell session, and directory for the current directory The default can be configured via `filter_mode` * Update docs * Add context --- atuin-client/src/settings.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'atuin-client/src/settings.rs') diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index ee3376a9..bb3424a4 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -23,6 +23,21 @@ pub enum SearchMode { Fuzzy, } +#[derive(Clone, Debug, Deserialize, Copy)] +pub enum FilterMode { + #[serde(rename = "global")] + Global, + + #[serde(rename = "host")] + Host, + + #[serde(rename = "session")] + Session, + + #[serde(rename = "directory")] + Directory, +} + // FIXME: Can use upstream Dialect enum if https://github.com/stevedonovan/chrono-english/pull/16 is merged #[derive(Clone, Debug, Deserialize, Copy)] pub enum Dialect { @@ -65,6 +80,7 @@ pub struct Settings { pub key_path: String, pub session_path: String, pub search_mode: SearchMode, + pub filter_mode: FilterMode, // This is automatically loaded when settings is created. Do not set in // config! Keep secrets and settings apart. pub session_token: String, @@ -147,6 +163,7 @@ impl Settings { .set_default("sync_frequency", "1h")? .set_default("sync_address", "https://api.atuin.sh")? .set_default("search_mode", "prefix")? + .set_default("filter_mode", "global")? .set_default("session_token", "")? .set_default("style", "auto")? .add_source( -- cgit v1.3.1