mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-16 10:30:44 +01:00
feat: option to include duplicate commands when printing history commands
This commit is contained in:
parent
80e950c648
commit
b331eef4df
@ -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 {
|
||||
@ -403,7 +404,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);
|
||||
|
@ -119,6 +119,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 {
|
||||
@ -215,6 +219,7 @@ impl Cmd {
|
||||
limit: self.limit,
|
||||
offset: self.offset,
|
||||
reverse: self.reverse,
|
||||
include_duplicates: self.include_duplicates,
|
||||
};
|
||||
|
||||
let mut entries =
|
||||
|
Loading…
Reference in New Issue
Block a user