1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
use bpaf::*;
use bpaf_derive::*;
use std::path::PathBuf;
use std::str::FromStr;
/*
#[derive(Debug, Clone, Bpaf)]
#[bpaf(parser(make_out))]
struct Out {
/// Activate debug mode
#[bpaf(short, long)]
debug: bool,
/// this comment is ignored
#[bpaf(parser(verbose))]
verbose: usize,
/// Set speed
#[bpaf(argument("SPEED"), fallback(42.0))]
speed: f64,
/// Output file
#[bpaf(argument("OUTPUT"))]
output: PathBuf,
#[bpaf(short, long)]
nb_cars: u32,
#[bpaf(argument("FILE"))]
files_to_process: Vec<PathBuf>,
}*/
#[derive(Debug, Clone, Bpaf)]
#[bpaf(parser(parse_command))]
enum Command {
#[bpaf(command("show"))]
/// show a thing blah blah blah
///
///
/// more descr here
Show { verbose: bool },
}
fn verbose() -> Parser<usize> {
// number of occurrences of the v/verbose flag capped at 3
short('v')
.long("verbose")
.help("Increase the verbosity\nYou can specify it up to 3 times\neither as -v -v -v or as -vvv")
.req_flag(())
.many()
.map(|xs| xs.len())
.guard(|&x| x <= 3, "It doesn't get any more verbose than this")
}
*/