ex_positional/
ex_positional.rs

1//! Non derive version for positional arguments
2use bpaf::*;
3use std::path::PathBuf;
4
5#[allow(dead_code)]
6#[derive(Debug, Clone)]
7struct Options {
8    value: u32,
9    files: Vec<PathBuf>,
10}
11
12fn main() {
13    let value = long("value")
14        .help("Mysterious value")
15        .argument::<u32>("VAL")
16        .fallback(42);
17    let files = positional::<PathBuf>("FILE").many();
18    let opts = construct!(Options { value, files }).to_options().run();
19
20    println!("{:#?}", opts);
21}