Group Args, so we enforce that only _one_ of them can be specified
This commit is contained in:
parent
a61b83df07
commit
c1fcf22619
1 changed files with 10 additions and 1 deletions
|
@ -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> {
|
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
app
|
app
|
||||||
|
@ -86,6 +86,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.takes_value(true) // non-optional, call-string
|
.takes_value(true) // non-optional, call-string
|
||||||
.required(false)
|
.required(false)
|
||||||
.help("View content in custom program, for example 'libreoffice %e', replace '%e' with entry path"))
|
.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")
|
.subcommand(SubCommand::with_name("compile")
|
||||||
|
|
Loading…
Reference in a new issue