From cd5d1628825e2f39c6291c393e73f429451df54b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 26 Aug 2016 15:12:06 +0200 Subject: [PATCH] Fix imag-tag::* for new StoreId interface --- imag-tag/src/main.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/imag-tag/src/main.rs b/imag-tag/src/main.rs index b01a74f0..f7c91dd0 100644 --- a/imag-tag/src/main.rs +++ b/imag-tag/src/main.rs @@ -10,14 +10,15 @@ extern crate libimagentrytag; extern crate libimagerror; use std::process::exit; +use std::path::PathBuf; use libimagrt::runtime::Runtime; use libimagrt::setup::generate_runtime_setup; use libimagentrytag::tagable::Tagable; use libimagentrytag::tag::Tag; -use libimagstore::storeid::build_entry_path; use libimagerror::trace::{trace_error, trace_error_exit}; use libimagentrytag::ui::{get_add_tags, get_remove_tags}; +use libimagstore::storeid::StoreId; mod ui; @@ -34,11 +35,13 @@ fn main() { .subcommand_name() .map_or_else( || { + let id = PathBuf::from(id); let add = get_add_tags(rt.cli()); let rem = get_remove_tags(rt.cli()); alter(&rt, id, add, rem); }, |name| { + let id = PathBuf::from(id); debug!("Call: {}", name); match name { "list" => list(id, &rt), @@ -50,9 +53,9 @@ fn main() { }); } -fn alter(rt: &Runtime, id: &str, add: Option>, rem: Option>) { +fn alter(rt: &Runtime, id: PathBuf, add: Option>, rem: Option>) { let path = { - match build_entry_path(rt.store(), id) { + match StoreId::new(Some(rt.store().path().clone()), id) { Err(e) => trace_error_exit(&e, 1), Ok(s) => s, } @@ -91,12 +94,10 @@ fn alter(rt: &Runtime, id: &str, add: Option>, rem: Option>) { } } -fn list(id: &str, rt: &Runtime) { - let path = { - match build_entry_path(rt.store(), id) { - Err(e) => trace_error_exit(&e, 1), - Ok(s) => s, - } +fn list(id: PathBuf, rt: &Runtime) { + let path = match StoreId::new(Some(rt.store().path().clone()), id) { + Err(e) => trace_error_exit(&e, 1), + Ok(s) => s, }; debug!("path = {:?}", path); @@ -108,8 +109,7 @@ fn list(id: &str, rt: &Runtime) { }, Err(e) => { - debug!("Could not get '{:?}' => {:?}", id, path); - warn!("Could not get entry '{}'", id); + warn!("Could not get entry '{:?}'", path); trace_error_exit(&e, 1); }, };