stash: move import logic into stash::commmands

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f8fb8c9b14049ba3a343bb453ca59004
This commit is contained in:
raf 2025-08-20 10:35:10 +03:00
commit 1ed518a3b6
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 47 additions and 15 deletions

View file

@ -11,19 +11,16 @@ use inquire::Confirm;
mod commands;
mod db;
mod import;
use crate::{
commands::{
decode::DecodeCommand,
delete::DeleteCommand,
list::ListCommand,
query::QueryCommand,
store::StoreCommand,
watch::WatchCommand,
wipe::WipeCommand,
},
use crate::commands::{
decode::DecodeCommand,
delete::DeleteCommand,
import::ImportCommand,
list::ListCommand,
query::QueryCommand,
store::StoreCommand,
watch::WatchCommand,
wipe::WipeCommand,
};
#[derive(Parser)]
@ -299,7 +296,9 @@ fn main() {
let format = r#type.as_deref().unwrap_or("tsv");
match format {
"tsv" => {
if let Err(e) = db.import_tsv(io::stdin(), cli.max_items) {
if let Err(e) =
ImportCommand::import_tsv(&db, io::stdin(), cli.max_items)
{
log::error!("Failed to import TSV: {e}");
}
},