#arg #valargs

valargs

A simple command-line argument helper for parsing positional arguments and options

3 releases

Uses new Rust 2024

new 0.1.2 Apr 15, 2025
0.1.1 Apr 15, 2025
0.1.0 Mar 20, 2025

#4 in #args

Download history 105/week @ 2025-03-18 12/week @ 2025-03-25 1/week @ 2025-04-01

118 downloads per month

MIT license

6KB
72 lines

A simple command-line argument helper for parsing positional arguments and options.

Example:

use valargs::Args;

fn main() {
    let args = Args::parse();

    if let Some(cat_name) = args.nth(1) {
        println!("the cat's name is {}", cat_name);
    }

    if args.has_option("orange") {
        println!("the cat is an orange cat")
    }

    if let Some(favorite_food) = args.option_value("favorite-food") {
        println!("the cat likes {} a lot", favorite_food)
    } else {
        println!("no information about the cat's favorite food...")
    }
}

No runtime deps