• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! How to require presence of at least N values,
2 //! like `val1 val2 ... valN ... valM`.
3 //!
4 //! Running this example with --help prints this message:
5 //! -----------------------------------------------------
6 //! structopt 0.3.25
7 //!
8 //! USAGE:
9 //!     at_least_two <foos>...
10 //!
11 //! FLAGS:
12 //!     -h, --help       Prints help information
13 //!     -V, --version    Prints version information
14 //!
15 //! ARGS:
16 //!     <foos>...
17 //! -----------------------------------------------------
18 
19 use structopt::StructOpt;
20 
21 #[derive(StructOpt, Debug)]
22 struct Opt {
23     #[structopt(required = true, min_values = 2)]
24     foos: Vec<String>,
25 }
26 
main()27 fn main() {
28     let opt = Opt::from_args();
29     println!("{:?}", opt);
30 }
31