argue

Crates.ioargue
lib.rsargue
version0.1.0
sourcesrc
created_at2020-11-24 03:53:11.977748
updated_at2020-11-24 03:53:11.977748
descriptionArgument parsing library for fun
homepage
repositoryhttps://github.com/cdecompilador/argue.git
max_upload_size
id315636
size11,107
(ElGusanitoPLAY)

documentation

README

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

Commit count: 7

cargo fmt