summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-04-19 22:00:42 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-04-19 22:08:34 +0200
commit36bc5175246932d25214db50b2df24c227127c5d (patch)
tree2cabf14e5a07260621058b31e8cf28b751cc846c
parentbed49b6ece5ef67689472e0eb7c4cbfc3167f5e0 (diff)
Add support for tagging/untagging multiple entries with one call
-rw-r--r--bin/core/imag-tag/src/main.rs11
-rw-r--r--bin/core/imag-tag/src/ui.rs4
2 files changed, 9 insertions, 6 deletions
diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs
index d291af69..8a131f8d 100644
--- a/bin/core/imag-tag/src/main.rs
+++ b/bin/core/imag-tag/src/main.rs
@@ -82,19 +82,22 @@ fn main() {
"Direct interface to the store. Use with great care!",
build_ui);
- let id = rt.cli().value_of("id").map(PathBuf::from).unwrap(); // enforced by clap
+ let ids = rt.cli().values_of("id").unwrap().map(PathBuf::from); // enforced by clap
+
rt.cli()
.subcommand_name()
.map(|name| match name {
- "list" => list(id, &rt),
- "remove" => {
+ "list" => for id in ids {
+ list(id, &rt)
+ },
+ "remove" => for id in ids {
let id = PathBuf::from(id);
let add = None;
let rem = get_remove_tags(rt.cli());
debug!("id = {:?}, add = {:?}, rem = {:?}", id, add, rem);
alter(&rt, id, add, rem);
},
- "add" => {
+ "add" => for id in ids {
let id = PathBuf::from(id);
let add = get_add_tags(rt.cli());
let rem = None;
diff --git a/bin/core/imag-tag/src/ui.rs b/bin/core/imag-tag/src/ui.rs
index 48c1bd11..40643d40 100644
--- a/bin/core/imag-tag/src/ui.rs
+++ b/bin/core/imag-tag/src/ui.rs
@@ -25,8 +25,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
app.arg(Arg::with_name("id")
.index(1)
.takes_value(true)
- .required(true)
- .multiple(false)
+ .required(false)
+ .multiple(true)
.value_name("ID")
.help("Entry to use"))