aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author依云 <lilydjwg@gmail.com>2025-07-03 23:35:18 +0800
committerGitHub <noreply@github.com>2025-07-03 16:35:18 +0100
commit58e307bc6df66f52509c57537e68194ce6d33577 (patch)
tree05bf09e791efc8fafe69a9f10161db8131b8f04b
parentchore(deps): bump lukemathwalker/cargo-chef (#2765) (diff)
downloadatuin-58e307bc6df66f52509c57537e68194ce6d33577.zip
fix: refuse "--dupkeep 0" (#2807)
People may think it would keep only one copy, but it didn't work that way.
-rw-r--r--crates/atuin/src/command/client/history.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/atuin/src/command/client/history.rs b/crates/atuin/src/command/client/history.rs
index d4ed22f6..74d9e155 100644
--- a/crates/atuin/src/command/client/history.rs
+++ b/crates/atuin/src/command/client/history.rs
@@ -622,6 +622,13 @@ impl Cmd {
dupkeep: u32,
dry_run: bool,
) -> Result<()> {
+ if dupkeep == 0 {
+ eprintln!(
+ "\"--dupkeep 0\" would keep 0 copies of duplicate commands and thus delete all of them! Use \"atuin search --delete ...\" if you really want that."
+ );
+ std::process::exit(1);
+ }
+
let matches: Vec<History> = db.get_dups(before, dupkeep).await?;
match matches.len() {