ecla

Crates.ioecla
lib.rsecla
version1.0.0
sourcesrc
created_at2016-11-12 08:53:23.531909
updated_at2016-11-13 02:52:22.908912
descriptionEasily build command line apps
homepagehttps://github.com/fengcen/ecla
repositoryhttps://github.com/fengcen/ecla.git
max_upload_size
id7213
size12,504
fvm-crate-owners (github:filecoin-project:fvm-crate-owners)

documentation

https://docs.rs/ecla

README

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.

Commit count: 0

cargo fmt