From 0c9d7367c66d5042348c46869ca4a8aa71aa6c86 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 23 Nov 2023 09:48:43 +0000 Subject: feat: allow configuring stats prefix (#1411) --- atuin-client/src/settings.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'atuin-client/src') diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index fca76004..c5e72025 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -143,6 +143,24 @@ pub enum WordJumpMode { Subl, } +#[derive(Clone, Debug, Deserialize)] +pub struct Stats { + pub common_prefix: Vec, // sudo, etc. commands we want to strip off + pub common_subcommands: Vec, // kubectl, commands we should consider subcommands for +} + +impl Default for Stats { + fn default() -> Self { + Self { + common_prefix: vec!["sudo", "doas"].into_iter().map(String::from).collect(), + common_subcommands: vec!["cargo", "go", "git", "npm", "yarn", "pnpm", "kubectl"] + .into_iter() + .map(String::from) + .collect(), + } + } +} + #[derive(Clone, Debug, Deserialize)] pub struct Settings { pub dialect: Dialect, @@ -169,10 +187,13 @@ pub struct Settings { pub word_jump_mode: WordJumpMode, pub word_chars: String, pub scroll_context_lines: usize, + #[serde(with = "serde_regex", default = "RegexSet::empty")] pub history_filter: RegexSet, + #[serde(with = "serde_regex", default = "RegexSet::empty")] pub cwd_filter: RegexSet, + pub secrets_filter: bool, pub workspaces: bool, pub ctrl_n_shortcuts: bool, @@ -181,6 +202,9 @@ pub struct Settings { pub network_timeout: u64, pub enter_accept: bool, + #[serde(default)] + pub stats: Stats, + // This is automatically loaded when settings is created. Do not set in // config! Keep secrets and settings apart. pub session_token: String, -- cgit v1.3.1