mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-13 14:33:47 +00:00
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:
parent
75ca501e29
commit
b0ee7f59a3
3 changed files with 2 additions and 44 deletions
|
|
@ -5,4 +5,3 @@ pub mod list;
|
|||
pub mod query;
|
||||
pub mod store;
|
||||
pub mod watch;
|
||||
pub mod wipe;
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
}
|
||||
}
|
||||
32
src/main.rs
32
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");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue