scp

Crates.ioscp
lib.rsscp
version0.6.1
sourcesrc
created_at2019-05-08 01:28:50.301304
updated_at2019-11-15 20:10:08.434417
descriptionA Rust library that parses strings of text as commands, subcommands, parameters and options.
homepage
repositoryhttps://github.com/idkp/scp
max_upload_size
id132727
size35,745
Federico (xzcool)

documentation

README

scp

A Simple Command Parser for Rust.

Usage

  • Add scp to your Cargo.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());
            }
        }
    }
    
Commit count: 0

cargo fmt