Guest User

Untitled

a guest
May 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. extern crate clap;
  2. use clap::{App, Arg, ArgGroup};
  3.  
  4. fn main() {
  5. let app = App::new("clap_weirdness")
  6. .arg(Arg::with_name("selection_a").short("a"))
  7. .arg(Arg::with_name("selection_b").short("b"))
  8. .arg(
  9. Arg::with_name("selection_c")
  10. .short("c")
  11. .conflicts_with("not_with_c"), // this also precludes -ae and -be
  12. )
  13. .group(
  14. ArgGroup::with_name("selection")
  15. .args(&["selection_a", "selection_b", "selection_c"])
  16. .required(true),
  17. )
  18. .arg(
  19. Arg::with_name("not_with_c")
  20. .short("e")
  21. //.conflicts_with("selection_c"), // this works as expected, only precluding -ce
  22. );
  23.  
  24. app.get_matches();
  25. }
Add Comment
Please, Sign In to add comment