comma 0.1.1

Shell-style command parser with support for escaping and quotations.
Documentation

comma

Crates.io docs.rs Build Status

comma parses shell-style commands, e.g. sendmsg joe "I say \"hi\" to you!", into a simple structure with a name and a list of arguments. It collapses excess whitespace, and allows for quoting or backslash-escaping text.

Cargo

[dependencies]
comma = "0.1.1"

Usage

use comma::Command;

fn main () {
    let parsed = Command::from_str("sendmsg joe \"I say \\"hi\\" to you!\"");
    println!("Command name: {}", parsed.name); // Command name: sendmsg
    println!("Command arguments: {:#?}", parsed.arguments); // Command arguments: [ "joe", "I say \"hi\" to you!" ]
}