ecla 1.0.0

Easily build command line apps
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented1 out of 1 items with examples
  • Size
  • Source code size: 15.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.49 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fengcen

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.