#cmd-line #parser #shell #building #default #bash-like #platform-resembling

cmdline-parser

Platform-resembling cmdline parsing for building shells

1 unstable release

Uses old Rust 2015

0.1.0 Feb 13, 2017

#12 in #cmd-line

Download history 24/week @ 2024-03-24 51/week @ 2024-03-31 21/week @ 2024-04-07 12/week @ 2024-04-14 20/week @ 2024-04-21 17/week @ 2024-04-28 13/week @ 2024-05-05 72/week @ 2024-05-12 57/week @ 2024-05-19 69/week @ 2024-05-26 60/week @ 2024-06-02 59/week @ 2024-06-09 56/week @ 2024-06-16 36/week @ 2024-06-23 31/week @ 2024-06-30 19/week @ 2024-07-07

145 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