diff --git a/src/main.rs b/src/main.rs index 35b69ce..c249865 100644 --- a/src/main.rs +++ b/src/main.rs @@ -445,46 +445,6 @@ fn mode_save(cmd: &mut Command, args: Args, ids: &mut Vec, tags: &mut Vec, tags: &mut Vec, conn: &mut Connection, data_path: PathBuf) -> Result<()> { - if ! ids.is_empty() && ! tags.is_empty() { - cmd.error(ErrorKind::InvalidValue, "Both ID and tags given, you must supply exactly one ID or atleast one tag when using --get").exit(); - } else if ids.len() > 1 { - cmd.error(ErrorKind::InvalidValue, "More than one ID given, you must supply exactly one ID or atleast one tag when using --get").exit(); - } - - let mut meta: HashMap = HashMap::new(); - for item in args.item.meta.iter() { - let item = item.clone(); - meta.insert(item.key, item.value); - } - - let item_maybe = match tags.is_empty() && meta.is_empty() { - true => match ids.iter().next() { - Some(item_id) => db::get_item(conn, *item_id)?, - None => db::get_item_last(conn)? - }, - false => db::get_item_matching(conn, tags, &meta)? - }; - - if let Some(item) = item_maybe { - debug!("MAIN: Found item {:?}", item); - - let mut item_path = data_path.clone(); - item_path.push(item.id.unwrap().to_string()); - - let compression_type = CompressionType::from_str(&item.compression)?; - debug!("MAIN: Item has compression type {:?}", compression_type.clone()); - - let compression_engine = get_engine(compression_type).expect("Unable to get compression engine"); - compression_engine.cat(item_path.clone())?; - - Ok(()) - } else { - Err(anyhow!("Unable to find matching item in database")) - } -} - - fn mode_diff( cmd: &mut clap::Command, _args: Args, // Mark as unused if not needed directly