commands: deprecate plain wipe command in favor of db wipe

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I62dbcc00b6b79f160318f9704fab001b6a6a6964
This commit is contained in:
raf 2026-04-03 14:44:44 +03:00
commit b0ee7f59a3
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 2 additions and 44 deletions

View file

@ -5,4 +5,3 @@ pub mod list;
pub mod query; pub mod query;
pub mod store; pub mod store;
pub mod watch; pub mod watch;
pub mod wipe;

View file

@ -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(())
}
}

View file

@ -32,9 +32,8 @@ use crate::{
query::QueryCommand, query::QueryCommand,
store::StoreCommand, store::StoreCommand,
watch::WatchCommand, watch::WatchCommand,
wipe::WipeCommand,
}, },
db::DEFAULT_MAX_ENTRY_SIZE, db::{ClipboardDb, DEFAULT_MAX_ENTRY_SIZE},
}; };
#[derive(Parser)] #[derive(Parser)]
@ -124,16 +123,6 @@ enum Command {
ask: bool, 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 /// Database management operations
Db { Db {
#[command(subcommand)] #[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 }) => { Some(Command::Db { action }) => {
match action { match action {
@ -424,7 +396,7 @@ fn main() -> eyre::Result<()> {
}, },
} }
} else { } else {
report_error(db.wipe(), "failed to wipe database"); report_error(db.wipe_db(), "failed to wipe database");
} }
} }
}, },