medusa

General template for building command line interface (CLI) using (and written in) Rust

How to use

```toml ...

[dependencies] medusa = "0.1.0" ... ```

rust ... use medusa::{CommandLine, HandlerVariant}; ...

```rust ... fn hello() { println!("Hello, world!"); }

fn echo(payload: String) { println!("payload : {}", payload); } ... ```

```rust ... use std::collections::HashMap;

let mut handlers: HashMap = HashMap::new(); handlers.insert(String::from("--hello"), HandlerVariant::Plain(hello)); handlers.insert(String::from("--echo"), HandlerVariant::WithArg(echo)); ... ```

```rust ... use std::env;

let mut command: CommandLine = CommandLine::new(); command.set_handler(handlers); command.run(env::args()); ... ```

bash cargo run -- --hello cargo run -- --echo something

bash cargo build