Structopt 'exactly one of'

Using StructOpt, is it possible to express a constraint that you have a set of arguments where you can only specify exactly one? For example, pacman operations where you can say "-S" or "-R" but not both. I'm aware of subcommands, but as far as I can tell, they can't be used as switches

clap allows arguments in an ArgGroup to conflict with each other: clap::ArgGroup - Rust

You may be able to adapt the example at https://github.com/TeXitoi/structopt/blob/62f59d3bfd13c8802f4065d57805eb905c9ec4b7/examples/group.rs to use it with structopt.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.