wena 0.0.3

Wena is a micro-framework that provides an elegant starting point for your console application.
Documentation

Wena was created by Nuno Maduro, and is a Rust Lang micro-framework that provides an elegant starting point for your console application.

This project is a work-in-progress. Code and documentation are currently under development and are subject to change.


Get Started

Requires Rust 1.57.0

First, install a recent release of Rust via the rustup:

rustup default stable

Next, create a new binary-based Cargo project:

cargo new my-cli-application --bin

Once the project is created, add wena as dependency in your Cargo.yml:

[dependencies]
wena = "0.0.3"

After, modify your src/main.rs file, and create your CLI application:

use wena::*;

fn main() {
    Application::new("calculator")
        .commands([Command::new("sum")
            .description("Add two numbers")
            .definition([
                Argument::new("first").required(true),
                Argument::new("second").required(true),
            ])
            .handler(|app| {
                let first = app.input.argument::<i32>("first").unwrap();
                let second = app.input.argument::<i32>("second").unwrap();

                app.output.writeln(format!("Total: {}", first + second));
            })])
        .run();
}

Finally, compile and run the with cargo run. You should see the following:

cargo run -q --

License

Wena is an open-source software licensed under the MIT license.