Argyle
This crate provides a simple streaming CLI argument parser/iterator called Argue
, offering a middle ground between the standard library's barebones std::env::args_os
helper and full-service crates like clap.
Argue
performs some basic normalization — it handles string conversion in a non-panicking way, recognizes shorthand value assignments like -kval
, -k=val
, --key=val
, and handles end-of-command (--
) arguments — and will help identify any special keys/values expected by your app.
The subsequent validation and handling, however, are left entirely up to you. Loop, match, and proceed however you see fit.
If that sounds terrible, just use clap instead. Haha.
Installation
Add argyle
to your dependencies
in Cargo.toml
, like:
[]
= "0.13.*"
Crate Features
The non-default try_paths
feature can be enabled to expose an additional Argument::Path
variant, used for unassociated-and-unrecognized values for which std::fs::exists() == Ok(true)
.
Example
A general setup might look something like the following.
Refer to the documentation for Argue
, KeyWord
, and Argument
for more information, caveats, etc.
use ;
use PathBuf;
/// # Configuration.
let args = args
.with_keywords;
// Loop and handle!
let mut settings = default;
for arg in args
// Now that you're set up, do stuff…