Command-line application framework.
The command line parser will search for the following pattern:
sh
$ myapp <COMMAND> <FLAGS> <PARAMS> -- <TAIL>
A simple command-line application could look something like this:
```rs use rawcmd::{Context, Command, Flag, Intent};
fn main() { match Command::withname("foo") .withdescription("Command 1") .withflag( Flag::withname("flag1") .withalias("f1") .withdescription("Flag 1") ) .withparam( Param::withname("param1") .withdescription("Param 1") ) .withsubcommand( Command::withname("bar") .withdescription("Command 1:1") .withflag( Flag::withname("flag2") .withalias("f2") .withdescription("Flag 2") ) .withresolver(|intent, &mut context| Ok(2)) ) .withresolver(|intent, &mut _context| Ok(3)) .withhandler(|_error, _intent, &mut _context| Ok(4)) .run( &mut Context::default(), ) { Ok(code) => { println!("Success: {:?}", code); std::process::exit(0); }, Err(error) => { println!("Error: {:?}", error); std::process::exit(1); }, } } ```
You can use your own custom context object as well:
rs
...
.run<MyContext>(
MyContext::default()
)