3 releases (1 stable)

Uses old Rust 2015

1.0.0 Nov 13, 2016
0.1.1 Nov 12, 2016
0.1.0 Nov 12, 2016

#69 in #arg

MIT license

10KB
251 lines

ecla

docs

Simple command line arguments parser for Rust.

Document

Usage

Add dependency to Cargo.toml

[dependencies]
ecla = "1.0.0"

In your main.rs:

extern crate ecla;

use ecla::App;

const HELP: &'static str = "This is help message";
const VERSION: &'static str = "1.0.0";

fn main() {
    let app = App::new(HELP, VERSION);
    if let Some(command) = app.get_command("test") {
        if let Some(flag) = command.get_flag(&["-a", "--all"]) {
            println!("You have run subcommand test with flag -a or --all");
        } else {
            println!("You have run subcommand test with no flag");
        }
    } else {
        app.show_unknown_or_help();
    }
}

Examples

For more usage, see the examples folder

Examples Screenshots

Screenshot

Screenshot

License

ecla is primarily distributed under the terms of the MIT license. See LICENSE for details.

Dependencies

~0.7–8.5MB
~53K SLoC