Command-line application framework.
Example:
use env;
use ;
let app = with_name
.with_description
.with_flag
.with_subcommand
.with_resolver
.perform;
match app
Notes:
- Add term
Command-line application framework.
Example:
use std::env;
use rawcmd::{Command, Flag, Intent};
fn resolver(intent: Intent) -> Option<usize> {
intent.command();
intent.supcommands();
intent.subcommands();
}
let app = Command::with_name("cmd1")
.with_description("Command 1")
.with_flag(
Flag::with_name("flag1")
.with_alias("f1")
.with_description("Flag 1")
.with_value(true, Some("default"))
)
.with_subcommand(
Command::with_name("cmd1:1")
.with_description("Command 1:1")
.with_flag(
Flag::with_name(flag2)
.with_alias("f2")
.with_description("Flag 2")
)
.with_resolver(resolver)
)
.with_resolver(|_| { Some(0) })
.perform(
env::args().skip(1).collect(),
);
match app {
Ok(v) => println!("OK: {:?}", v),
Err(v) => println!("Err: {:?}", v),
}
Notes: