1 unstable release
Uses old Rust 2015
0.1.0 | Feb 13, 2017 |
---|
#9 in #cmd-line
126 downloads per month
Used in torus
13KB
277 lines
cmdline-parser
Library to parse cmdlines in a way that resembles the platform default. Supports cmd and bash-like parsing.
Example
extern crate cmdline_parser;
use cmdline_parser::Parser;
fn main() {
let mut parser = Parser::new(r#"mv "my file" project/"#);
assert_eq!(parser.next(), Some((0..2, "mv".into())));
assert_eq!(parser.next(), Some((3..12, "my file".into())));
assert_eq!(parser.next(), Some((13..21, "project/".into())));
assert_eq!(parser.next(), None);
}
Licence
This library is licensed under the terms of the MIT and Apache 2.0 licences.
lib.rs
:
Parse cmdlines in a way that resembles the platform default.
Example
use cmdline_parser::Parser;
let mut parser = Parser::new(r#"mv "my file" project/"#);
assert_eq!(parser.next(), Some((0..2, "mv".into())));
assert_eq!(parser.next(), Some((3..12, "my file".into())));
assert_eq!(parser.next(), Some((13..21, "project/".into())));
assert_eq!(parser.next(), None);