argue 0.1.0

Argument parsing library for fun
Documentation
  • Coverage
  • 76.19%
    16 out of 21 items documented0 out of 16 items with examples
  • Size
  • Source code size: 10.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.41 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • cdecompilador/argue
    1 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ElGusanitoPLAY

Argue

Argue is a cli argument parser similar to clap, its just a for fun project, not serious for the moment.

Example

use args::{app, Argument, ArgumentType};

/// HOW TO:
///
/// Execute the program this way cargo r --example example0 -- -j 12
/// Also you can try --help, -h, -v, --version that are enabled by default
fn main() {
    // The arguments must be set separeted from the passing to the `arguments`
    // function
    let arguments = &[
        Argument::new(
            // The false is to say than the argument is not mandatory
            ArgumentType::Paired(false), 
            &["-j", "-jthreads"], 
            "Set the number of threads"
        ),
    ];
    
    // Ez to understand i think, pretty close to clap
    let arg_parser = app("Example0")
        .description("An example of the arg parser")
        .version("0.0.1")
        .arguments(arguments)
        .build();
    
    // Get an argument equaled, also work even if -jthreads is passed through
    // the cli
    let n = arg_parser.get("-j").unwrap();
    println!("Number of cores: {}", n);
}

Contribute

Everythins is accepted, just document properly what you do