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.
[dependencies]
comma = "0.1.2"
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!" ]
}