summaryrefslogtreecommitdiffstats
path: root/imag-view
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-03-06 12:42:01 +0100
committerMatthias Beyer <mail@beyermatthias.de>2016-03-11 16:21:51 +0100
commitc1fcf226196e700df9f6ad43dc1325f5e67f0591 (patch)
tree36f4d826e6cd07d9e15d7abf46eca1bb6256ca21 /imag-view
parenta61b83df07b48ec5ae0b5b57a41a906c576971a5 (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.rs11
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")