mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-19 00:49:52 +00:00
modularize codebase
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a69648ea836bfeb539450db14a666c623412e
This commit is contained in:
parent
478c020579
commit
b0820a1940
10 changed files with 445 additions and 252 deletions
31
src/commands/store.rs
Normal file
31
src/commands/store.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use crate::db::{ClipboardDb, SledClipboardDb};
|
||||
use std::io::Read;
|
||||
|
||||
pub trait StoreCommand {
|
||||
fn store(
|
||||
&self,
|
||||
input: impl Read,
|
||||
max_dedupe_search: u64,
|
||||
max_items: u64,
|
||||
state: Option<String>,
|
||||
);
|
||||
}
|
||||
|
||||
impl StoreCommand for SledClipboardDb {
|
||||
fn store(
|
||||
&self,
|
||||
input: impl Read,
|
||||
max_dedupe_search: u64,
|
||||
max_items: u64,
|
||||
state: Option<String>,
|
||||
) {
|
||||
match state.as_deref() {
|
||||
Some("sensitive") | Some("clear") => {
|
||||
self.delete_last();
|
||||
}
|
||||
_ => {
|
||||
self.store_entry(input, max_dedupe_search, max_items);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue