#parser #cmd-line #building #shell

cmdline-parser

Platform-resembling cmdline parsing for building shells

1 unstable release

Uses old Rust 2015

0.1.0 Feb 13, 2017

#9 in #cmd-line

Download history 21/week @ 2024-07-19 31/week @ 2024-07-26 215/week @ 2024-08-02 208/week @ 2024-08-09 21/week @ 2024-08-16 61/week @ 2024-08-23 12/week @ 2024-08-30 14/week @ 2024-09-06 53/week @ 2024-09-13 20/week @ 2024-09-20 37/week @ 2024-09-27 11/week @ 2024-10-04 12/week @ 2024-10-11 22/week @ 2024-10-18 41/week @ 2024-10-25 51/week @ 2024-11-01

126 downloads per month
Used in torus

MIT/Apache

13KB
277 lines

cmdline-parser

Documentation

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);

No runtime deps