abs-cli 0.2.2

CLI parsing library
Documentation
  • Coverage
  • 50%
    13 out of 26 items documented0 out of 11 items with examples
  • Size
  • Source code size: 8.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • absurdish

abs-cli

Lightweight CLI parser in Rust.

examples

use abs_cli::CLI;

fn main() {
    let mut program = CLI::new();
    program
        .name("My Program")
        .version("1.0.0")
        .description("My super cool cli program")
        .option("-l, --ls", "list the directory")
        .arg("run", "run <file>", "run the file");
    program.parse();

    if let Some(ls_values) = program.get("--ls") {
        println!("Option --ls provided with value: {:?}", ls_values);
    }

    if let Some(run_values) = program.get("run") {
        println!("Argument run provided with value: {:?}", run_values);
    }
}

If command --ls was passed, Some value will be returned. If there is a value after --ls, for example: --ls hello, value will be: hello.

Library has built-in help (--help, -h) and version (--version, -v) commands.