cmder 0.3.0

A simple, lightweight, command line argument parser for rust codebases
Documentation

A simple, lightweight and extensible command line argument parser for rust codebases.

This crate is fairly similar to the javascript package commander-js. To get started, create an instance of the program struct and use it to add commands. The following is an example:


let mut program = Program::new();

    program
        .version("0.1.0")
        .description("An example CLI")
        .author("Author's name");

    program
        .command("test <app-name>")
        .alias("t")
        .description("A test command")
        .option("-s --skip", "Skip checking/installing the dependencies")
        .option("-p --priority", "The priority to use when testing apps")
        .action(|vals, opts| {
            dbg!(vals);
            dbg!(opts);
        })
        .build(&mut program);

You can also override the default behavior of the program. You can edit the Themes and how information is printed out to stdout as follows:

program.on(Event::OutputVersion, |p, v| {
        println!("You are using version {} of my program", v);
        println!("This program was authored by: {}", p.get_author();
    });

Refer to docs.rs for full documentation on the crate.