derive_this_or_that/
derive_this_or_that.rs

1//! deriving for tri-state enabled/disabled/undecided switch, combinatoric version would use
2//! combination of `req_flag` and `construct!([on, off])`
3
4#![allow(dead_code)]
5use bpaf::Bpaf;
6
7// By default bpaf tries to parse booleans as flags, do something smart
8// about Strings and file names and handles Option/Vec.
9// Everything else is handled as a textual named argument.
10#[derive(Debug, Clone, Bpaf)]
11#[bpaf(options, fallback(Opts::Undecided))]
12enum Opts {
13    /// enabled
14    On,
15    /// disabled
16    Off,
17    /// undecined
18    #[bpaf(skip)]
19    Undecided,
20}
21
22fn main() {
23    println!("{:?}", opts().run())
24}