Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate clap;
- use clap::{App, Arg, ArgGroup};
- fn main() {
- let app = App::new("clap_weirdness")
- .arg(Arg::with_name("selection_a").short("a"))
- .arg(Arg::with_name("selection_b").short("b"))
- .arg(
- Arg::with_name("selection_c")
- .short("c")
- .conflicts_with("not_with_c"), // this also precludes -ae and -be
- )
- .group(
- ArgGroup::with_name("selection")
- .args(&["selection_a", "selection_b", "selection_c"])
- .required(true),
- )
- .arg(
- Arg::with_name("not_with_c")
- .short("e")
- //.conflicts_with("selection_c"), // this works as expected, only precluding -ce
- );
- app.get_matches();
- }
Add Comment
Please, Sign In to add comment