summaryrefslogtreecommitdiffstats
path: root/imag-tag/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'imag-tag/src/main.rs')
-rw-r--r--imag-tag/src/main.rs22
1 files 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<Vec<Tag>>, rem: Option<Vec<Tag>>) {
+fn alter(rt: &Runtime, id: PathBuf, add: Option<Vec<Tag>>, rem: Option<Vec<Tag>>) {
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<Vec<Tag>>, rem: Option<Vec<Tag>>) {
}
}
-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);
},
};