diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-11-23 09:48:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-23 09:48:43 +0000 |
commit | 0c9d7367c66d5042348c46869ca4a8aa71aa6c86 (patch) | |
tree | dfce8f68edaffcf680e3ce54fb2e8e360d972ef2 /atuin-client/src | |
parent | fbaa245439b0b3829b953627d3fcaee93baf3c52 (diff) |
feat: allow configuring stats prefix (#1411)
Diffstat (limited to 'atuin-client/src')
-rw-r--r-- | atuin-client/src/settings.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index fca760042..c5e720257 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -144,6 +144,24 @@ pub enum WordJumpMode { } #[derive(Clone, Debug, Deserialize)] +pub struct Stats { + pub common_prefix: Vec<String>, // sudo, etc. commands we want to strip off + pub common_subcommands: Vec<String>, // 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, pub style: Style, @@ -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, |