Documentation
  • Coverage
  • 90.91%
    10 out of 11 items documented0 out of 5 items with examples
  • Size
  • Source code size: 5.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.51 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Ouki76/oargs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Ouki76

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"));
    }
}