positional_derive/
positional_derive.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Derive for struct with named values that uses positional argument

use bpaf::*;
use std::path::PathBuf;

#[allow(dead_code)]
#[derive(Debug, Clone, Bpaf)]
#[bpaf(options)]
struct Options {
    /// Mysterious value
    #[bpaf(argument("VAL"), fallback(42))]
    value: u32,
    #[bpaf(positional("FILE"))]
    files: Vec<PathBuf>,
}

fn main() {
    let opts = options().run();
    println!("{:#?}", opts);
}