Uses old Rust 2015
0.6.1 |
|
---|---|
0.6.0 |
|
0.5.0 |
|
0.4.0 |
|
0.1.2 |
|
#9 in #commands
32KB
842 lines
scp
A Simple Command Parser for Rust.
Usage
- Add
scp
to yourCargo.toml
file:[dependencies] scp = "^0"
- Start coding!
extern crate scp; use scp::{CommandLine, Command, ExecResult, ParamAccessor}; fn main() { let mut command_line = CommandLine::new(); command_line.register(Command::new("greet").set_syntax_format("s")); match command_line.run("greet John\\ Doe") { ExecResult::Err(e) => { // handle }, ExecResult::Ok{ command, subcommand, parameters, options } => { println!("Hello, {}!", parameters.poll()); } } }