2 releases

0.1.1 May 22, 2023
0.1.0 May 22, 2023

#36 in #args

MIT/Apache

5KB
72 lines

bene

Bene is a library for parsing command line arguments efficiently and elegantly.

Example:
The command line arguments:

-f 20 --length 5 --lib

Would be parsed as:

let mut frames: usize = 30; // default values
let mut length = 3; // inferred i32
let mut lib = false; // non valued flags are treated as booleans

// let input = "-f 20 --length 5 --lib"
bene::Intake::new()
    .arg('f', "frames", &mut frames)
    .arg('l', "length", &mut length)
    .arg('L', "lib", &mut lib) // case sensitive!
    .process(input);

assert_eq!(frames, 20);
assert_eq!(length, 5);
assert_eq!(lib, true);

Dependencies

~2.2–3MB
~55K SLoC