#arg #parser #valargs

valargs

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

4 releases

Uses new Rust 2024

new 0.1.3 May 2, 2025
0.1.2 Apr 15, 2025
0.1.1 Apr 15, 2025
0.1.0 Mar 20, 2025

#6 in #args

Download history 45/week @ 2025-03-14 71/week @ 2025-03-21 2/week @ 2025-03-28 172/week @ 2025-04-11 42/week @ 2025-04-18

217 downloads per month

MIT license

6KB
75 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