aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/settings.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2022-04-22 21:05:02 +0100
committerGitHub <noreply@github.com>2022-04-22 21:05:02 +0100
commit508d4f476157384b0d454bee3dd6e9256560561b (patch)
tree9eb2fbc5a9a51d3419e9e684a01fe5a2106e77c9 /atuin-client/src/settings.rs
parentrefactor (#327) (diff)
downloadatuin-508d4f476157384b0d454bee3dd6e9256560561b.zip
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
Diffstat (limited to 'atuin-client/src/settings.rs')
-rw-r--r--atuin-client/src/settings.rs17
1 files changed, 17 insertions, 0 deletions
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(