diff options
| author | 依云 <lilydjwg@gmail.com> | 2025-03-24 19:16:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-24 11:16:26 +0000 |
| commit | 92ff75604d6bdcfa2e613569f2b288ae81436db5 (patch) | |
| tree | 44fa33ad514412114495e726825da91743fc104b /crates | |
| parent | docs: update logo and badges in README for zh-CN (#2392) (diff) | |
| download | atuin-92ff75604d6bdcfa2e613569f2b288ae81436db5.zip | |
feat: option to include duplicate commands when printing history commands (#2407)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin-client/src/database.rs | 5 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/search.rs | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/crates/atuin-client/src/database.rs b/crates/atuin-client/src/database.rs index fd0284ba..de362766 100644 --- a/crates/atuin-client/src/database.rs +++ b/crates/atuin-client/src/database.rs @@ -51,6 +51,7 @@ pub struct OptFilters { pub limit: Option<i64>, pub offset: Option<i64>, pub reverse: bool, + pub include_duplicates: bool, } pub fn current_context() -> Context { @@ -410,7 +411,9 @@ impl Database for Sqlite { ) -> Result<Vec<History>> { let mut sql = SqlBuilder::select_from("history"); - sql.group_by("command").having("max(timestamp)"); + if !filter_options.include_duplicates { + sql.group_by("command").having("max(timestamp)"); + } if let Some(limit) = filter_options.limit { sql.limit(limit); diff --git a/crates/atuin/src/command/client/search.rs b/crates/atuin/src/command/client/search.rs index d8635316..7cc879f5 100644 --- a/crates/atuin/src/command/client/search.rs +++ b/crates/atuin/src/command/client/search.rs @@ -123,6 +123,10 @@ pub struct Cmd { /// Set the maximum number of lines Atuin's interface should take up. #[arg(long = "inline-height")] inline_height: Option<u16>, + + /// Include duplicate commands in the output (non-interactive only) + #[arg(long)] + include_duplicates: bool, } impl Cmd { @@ -221,6 +225,7 @@ impl Cmd { limit: self.limit, offset: self.offset, reverse: self.reverse, + include_duplicates: self.include_duplicates, }; let mut entries = |
