Enforce arguments by using ArgGroup

This commit is contained in:
Matthias Beyer 2016-04-12 17:01:54 +02:00
parent f0c6ac7630
commit 0483283638

View file

@ -1,4 +1,4 @@
use clap::{Arg, App, SubCommand}; use clap::{Arg, ArgGroup, App, 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
@ -87,6 +87,10 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.required(false) .required(false)
.help("List external links")) .help("List external links"))
.group(ArgGroup::with_name("external-link-group")
.args(&["add", "remove", "set", "list"])
.required(true))
) )
} }