1 unstable release

0.1.0 Apr 18, 2024

#61 in #arg

MIT license

5KB
67 lines

oargs

Argument Parser

Install

cargo add oargs

or

[dependencies]
oargs = "0.1.0"

Example

use oargs::{arg, Args};

fn main() {
    let args = vec![
        arg!({
            name: "about_arg",
            short: "a",
            long: "about"
        }),
        arg!({
            name: "version_arg",
            short: "v",
            long: "version"
        }),
    ];

    let args_obj = Args::new(args, std::env::args().collect());

    if args_obj.contains("help_arg") {
        println!("Help");
    }

    if args_obj.contains("version_arg") {
        println!("Version {}", std::env!("CARGO_PKG_VERSION"));
    }
}

No runtime deps