diff --git a/imag-tag/src/main.rs b/imag-tag/src/main.rs index e45479b3..9b04b7de 100644 --- a/imag-tag/src/main.rs +++ b/imag-tag/src/main.rs @@ -122,15 +122,7 @@ fn list(id: &str, rt: &Runtime) { let sepp_out = scmd.is_present("sep"); let mut comm_out = scmd.is_present("commasep"); - let flags = vec![json_out, line_out, comm_out, sepp_out]; - - if flags.iter().filter(|x| **x).count() > 1 { - // More than one flag passed - info!("Cannot do more than one thing"); - exit(1); - } - - if !flags.iter().any(|v| *v) { + if !vec![json_out, line_out, comm_out, sepp_out].iter().any(|v| *v) { // None of the flags passed, go to default comm_out = true; } diff --git a/imag-tag/src/ui.rs b/imag-tag/src/ui.rs index 6c90774b..4f78bf1f 100644 --- a/imag-tag/src/ui.rs +++ b/imag-tag/src/ui.rs @@ -1,4 +1,4 @@ -use clap::{Arg, App, SubCommand}; +use clap::{Arg, App, ArgGroup, SubCommand}; pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { app.arg(Arg::with_name("id") @@ -59,6 +59,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .takes_value(true) .required(false) .help("Seperated by string")) + + .group(ArgGroup::with_name("list-group") + .args(&[ + "json", + "linewise", + "commasep", + "sep", + ]) + .required(true)) ) }