aboutsummaryrefslogtreecommitdiff
path: root/structopt/examples/at_least_two.rs
blob: 683db503d527d7a00595c61e72e8c88fb1529ac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! How to require presence of at least N values,
//! like `val1 val2 ... valN ... valM`.

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
struct Opt {
    #[structopt(required = true, min_values = 2)]
    foos: Vec<String>,
}

fn main() {
    let opt = Opt::from_args();
    println!("{:?}", opt);
}