argpars 0.1.3

Dependency-less, simple yet functional Command Line Argument Parser
Documentation
  • Coverage
  • 9.38%
    3 out of 32 items documented1 out of 16 items with examples
  • Size
  • Source code size: 19.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.8 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Ernest1338/argpars
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Ernest1338

argpars

Dependency-less, simple yet functional Command Line Argument Parser

Features

TODO

Usage

Basic usage (checkout the examples/usage.rs file for more information)

use argpars::*;

fn main() {
    let mut args: ArgsObj = Argpars::new();

    // Setting basic info about the app
    args.help_usage = format!("Usage: {} [OPTION]... [TEST]\n", args.arguments_passed[0]);
    args.help_name = "Test App".to_string();
    args.help_description = "This is a test description".to_string();
    args.help_version = "v1.0".to_string();

    // Adding arguments into the app
    args.add_argument("--print-stuff", "display \"stuff\"");

    // This is how you execute something when no arguments were passed
    if args.no_arguments_passed() {
        args.display_help_screen();
    }
    // This is how you ignore other arguments when the default (help, version) or wrong ones were passed
    else if args.default_arguments_passed() || args.wrong_arguments_passed() {
    }
    // Here you handle the rest of the arguments
    else {
        if args.passed("--print-stuff") {
            println!("stuff");
        }
    }

    // Executing Argpars parser and exiting from the app with a return value
    std::process::exit(args.pars());
}

LICENSE

This project is distributed under MIT license.