diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-03-06 12:42:01 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-03-11 16:21:51 +0100 |
commit | c1fcf226196e700df9f6ad43dc1325f5e67f0591 (patch) | |
tree | 36f4d826e6cd07d9e15d7abf46eca1bb6256ca21 /imag-view | |
parent | a61b83df07b48ec5ae0b5b57a41a906c576971a5 (diff) |
Group Args, so we enforce that only _one_ of them can be specified
Diffstat (limited to 'imag-view')
-rw-r--r-- | imag-view/src/ui.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/imag-view/src/ui.rs b/imag-view/src/ui.rs index 2c5818de..619e4f27 100644 --- a/imag-view/src/ui.rs +++ b/imag-view/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 @@ -86,6 +86,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .takes_value(true) // non-optional, call-string .required(false) .help("View content in custom program, for example 'libreoffice %e', replace '%e' with entry path")) + + .group(ArgGroup::with_name("viewer") + .args(&["view-in-stdout", + "view-in-ui", + "view-in-browser", + "view-in-texteditor", + "view-in-custom", + ]) + .required(false)) ) .subcommand(SubCommand::with_name("compile") |