A helpers toolkit to make programs more simply.
sh
cargo add eywa
```rust
mod tests {
use std::collections::HashMap;
use eywa::program::pandora::Program;
fn init_project(mut p: Program) -> Result<String, String> {
if p.mkdir("docs") {
p.ok()
}
p.ko()
}
fn help(mut p: Program) -> Result<String, String> {
p.help()
}
fn main(mut p: Program) -> Result<String, String> {
let args: Vec<String> = p.args();
if p.no_args() {
return p.ko();
}
let init: bool = p.matches(&args[1], "init");
p.call(init, init_project, help)
}
#[test]
pub fn ok() {
let mut doc = HashMap::new();
doc.insert("zuu", "Run all test based on zuu.yml");
doc.insert("zuu init", "Initialyse a new repository");
let mut program = Program::new("zuu", "A toolkit program", doc);
program.with("init");
assert!(program.run(main).is_ok());
}
} ```