Argyle

This crate provides an argue! macro for generating a CLI argument enum and parsing iterator, ideal for use cases requiring more than the standard library's barebones args_os helper, but less than full-service options like clap.
Example
The docs contain a lot of addition details, but here's a minimal preview to give you an idea of what it's all about.
use argyle::argue;
argue! {
Help "-h" "--help",
Version "-V" "--version",
Stderr "--stderr",
@options
Format "--format",
Level "-l" "--level",
}
fn main() {
let mut stderr = false;
let mut format: Option<Format> = None;
let mut level = 0_u8;
let mut paths: Vec<PathBuf> = Vec::new();
for arg in Argument::args_os() {
match arg {
Argument::Help => print_help(),
Argument::Version => print_version(),
Argument::Stderr => { stderr = true; },
Argument::Format(v) => {
format = Format::from_str(v);
},
Argument::Level(v) => {
level = v.parse().unwrap_or(0);
},
Argument::Other(v) => {
eprintln!("Warning: unrecognized CLI argument {v}.");
},
Argument::OtherOs(v) => {
eprintln!(
"Warning: unrecognized CLI argument {}.",
v.display(),
);
},
}
}
}
Installation
Add argyle to your dependencies in Cargo.toml, like:
[dependencies]
argyle = "0.14.*"