From b0ee7f59a3804ae7672e622c1b924a9cfe091df1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 3 Apr 2026 14:44:44 +0300 Subject: [PATCH] commands: deprecate plain `wipe` command in favor of `db wipe` Signed-off-by: NotAShelf Change-Id: I62dbcc00b6b79f160318f9704fab001b6a6a6964 --- src/commands/mod.rs | 1 - src/commands/wipe.rs | 13 ------------- src/main.rs | 32 ++------------------------------ 3 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 src/commands/wipe.rs diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 67e9950..86b8c99 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -5,4 +5,3 @@ pub mod list; pub mod query; pub mod store; pub mod watch; -pub mod wipe; diff --git a/src/commands/wipe.rs b/src/commands/wipe.rs deleted file mode 100644 index 2126347..0000000 --- a/src/commands/wipe.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::db::{ClipboardDb, SqliteClipboardDb, StashError}; - -pub trait WipeCommand { - fn wipe(&self) -> Result<(), StashError>; -} - -impl WipeCommand for SqliteClipboardDb { - fn wipe(&self) -> Result<(), StashError> { - self.wipe_db()?; - log::info!("database wiped"); - Ok(()) - } -} diff --git a/src/main.rs b/src/main.rs index 3075e20..f6359b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,9 +32,8 @@ use crate::{ query::QueryCommand, store::StoreCommand, watch::WatchCommand, - wipe::WipeCommand, }, - db::DEFAULT_MAX_ENTRY_SIZE, + db::{ClipboardDb, DEFAULT_MAX_ENTRY_SIZE}, }; #[derive(Parser)] @@ -124,16 +123,6 @@ enum Command { ask: bool, }, - /// Wipe all clipboard history - /// - /// DEPRECATED: Use `stash db wipe` instead - #[command(hide = true)] - Wipe { - /// Ask for confirmation before wiping - #[arg(long)] - ask: bool, - }, - /// Database management operations Db { #[command(subcommand)] @@ -380,23 +369,6 @@ fn main() -> eyre::Result<()> { } } }, - Some(Command::Wipe { ask }) => { - eprintln!( - "Warning: The 'stash wipe' command is deprecated. Use 'stash db \ - wipe' instead." - ); - let mut should_proceed = true; - if ask { - should_proceed = - confirm("Are you sure you want to wipe all clipboard history?"); - if !should_proceed { - log::info!("wipe command aborted by user."); - } - } - if should_proceed { - report_error(db.wipe(), "failed to wipe database"); - } - }, Some(Command::Db { action }) => { match action { @@ -424,7 +396,7 @@ fn main() -> eyre::Result<()> { }, } } else { - report_error(db.wipe(), "failed to wipe database"); + report_error(db.wipe_db(), "failed to wipe database"); } } },