From 58e307bc6df66f52509c57537e68194ce6d33577 Mon Sep 17 00:00:00 2001 From: 依云 Date: Thu, 3 Jul 2025 23:35:18 +0800 Subject: fix: refuse "--dupkeep 0" (#2807) People may think it would keep only one copy, but it didn't work that way. --- crates/atuin/src/command/client/history.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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 = db.get_dups(before, dupkeep).await?; match matches.len() { -- cgit v1.3.1