Crates.io | bene |
lib.rs | bene |
version | 0.1.1 |
source | src |
created_at | 2023-05-22 04:18:05.567777 |
updated_at | 2023-05-22 21:56:11.023196 |
description | A command line argument parser/reader |
homepage | |
repository | https://github.com/sagansfault/bene |
max_upload_size | |
id | 870353 |
size | 4,891 |
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);