Skip to content

Commit 92ff756

Browse files
authored
feat: option to include duplicate commands when printing history commands (#2407)
1 parent 6428fb6 commit 92ff756

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crates/atuin-client/src/database.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct OptFilters {
5151
pub limit: Option<i64>,
5252
pub offset: Option<i64>,
5353
pub reverse: bool,
54+
pub include_duplicates: bool,
5455
}
5556

5657
pub fn current_context() -> Context {
@@ -410,7 +411,9 @@ impl Database for Sqlite {
410411
) -> Result<Vec<History>> {
411412
let mut sql = SqlBuilder::select_from("history");
412413

413-
sql.group_by("command").having("max(timestamp)");
414+
if !filter_options.include_duplicates {
415+
sql.group_by("command").having("max(timestamp)");
416+
}
414417

415418
if let Some(limit) = filter_options.limit {
416419
sql.limit(limit);

crates/atuin/src/command/client/search.rs

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ pub struct Cmd {
123123
/// Set the maximum number of lines Atuin's interface should take up.
124124
#[arg(long = "inline-height")]
125125
inline_height: Option<u16>,
126+
127+
/// Include duplicate commands in the output (non-interactive only)
128+
#[arg(long)]
129+
include_duplicates: bool,
126130
}
127131

128132
impl Cmd {
@@ -221,6 +225,7 @@ impl Cmd {
221225
limit: self.limit,
222226
offset: self.offset,
223227
reverse: self.reverse,
228+
include_duplicates: self.include_duplicates,
224229
};
225230

226231
let mut entries =

0 commit comments

Comments
 (0)