imag-tag: Fix commandline extracting by using helpers from libimagentrytag

This commit is contained in:
Matthias Beyer 2016-05-19 16:20:32 +02:00
parent 257474be22
commit 435fd6d7aa

View file

@ -13,8 +13,10 @@ use std::process::exit;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagentrytag::tagable::Tagable; use libimagentrytag::tagable::Tagable;
use libimagentrytag::tag::Tag;
use libimagstore::storeid::build_entry_path; use libimagstore::storeid::build_entry_path;
use libimagerror::trace::trace_error; use libimagerror::trace::trace_error;
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
mod ui; mod ui;
@ -41,9 +43,8 @@ fn main() {
.subcommand_name() .subcommand_name()
.map_or_else( .map_or_else(
|| { || {
let add = rt.cli().values_of("add").map(|o| o.map(String::from)); let add = get_add_tags(rt.cli());
let rem = rt.cli().values_of("remove").map(|o| o.map(String::from)); let rem = get_remove_tags(rt.cli());
alter(&rt, id, add, rem); alter(&rt, id, add, rem);
}, },
|name| { |name| {
@ -58,7 +59,7 @@ fn main() {
}); });
} }
fn alter<SI: Iterator<Item = String>>(rt: &Runtime, id: &str, add: Option<SI>, rem: Option<SI>) { fn alter(rt: &Runtime, id: &str, add: Option<Vec<Tag>>, rem: Option<Vec<Tag>>) {
let path = { let path = {
match build_entry_path(rt.store(), id) { match build_entry_path(rt.store(), id) {
Err(e) => { Err(e) => {