Skip to content

Commit

Permalink
fix(history): disallow deletion if the '--limit' flag is present (#1436)
Browse files Browse the repository at this point in the history
Co-authored-by: sdr13528 <[email protected]>
  • Loading branch information
sdr135284 and sdr13528 authored Dec 11, 2023
1 parent edc4958 commit 2185212
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions atuin/src/command/client/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ pub struct Cmd {

impl Cmd {
pub async fn run(self, db: impl Database, settings: &mut Settings) -> Result<()> {
if (self.delete_it_all || self.delete) && self.limit.is_some() {
// Because of how deletion is implemented, it will always delete all matches
// and disregard the limit option. It is also not clear what deletion with a
// limit would even mean. Deleting the LIMIT most recent entries that match
// the search query would make sense, but that wouldn't match what's displayed
// when running the equivalent search, but deleting those entries that are
// displayed with the search would leave any duplicates of those lines which may
// or may not have been intended to be deleted.
println!("\"--limit\" is not compatible with deletion.");
return Ok(());
}

if self.delete && self.query.is_empty() {
println!("Please specify a query to match the items you wish to delete. If you wish to delete all history, pass --delete-it-all");
return Ok(());
Expand Down

1 comment on commit 2185212

@vercel
Copy link

@vercel vercel bot commented on 2185212 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

atuin-docs – ./

atuin-docs-atuin.vercel.app
atuin-docs-git-main-atuin.vercel.app
atuin-docs.vercel.app

Please sign in to comment.