use snap_cli::{app::App, arg::Arg, command::Command};
fn main() {
let app = App::new("cli")
.version("1.0.0")
.author("Blue")
.about("A simple CLI app")
.arg(Arg::new("verbose").about("Enable verbose mode").is_flag(true))
.command(
Command::new("echo")
.about("Prints what you say")
.execute(|matches| {
let text = matches.value_of_str("text", "No text provided");
println!("{}", text);
}),
);
let main_command = Command::new("main")
.about("The main command")
.arg(Arg::new("text").about("The text to print").default("Hello, world!"))
.subcommand(
Command::new("sub")
.about("A subcommand")
.arg(Arg::new("a").about("add a").default("0"))
.arg(Arg::new("b").about("add b").default("0"))
.execute(|matches| {
let a = matches.value_of_int("a", 0);
let b = matches.value_of_int("b", 0);
println!("{}", a + b);
}),
);
let _app = app.command(main_command).get_matches();
}