#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 21/week @ 2024-04-08 11/week @ 2024-04-15 22/week @ 2024-04-22 15/week @ 2024-04-29 13/week @ 2024-05-06 97/week @ 2024-05-13 34/week @ 2024-05-20 72/week @ 2024-05-27 55/week @ 2024-06-03 62/week @ 2024-06-10 55/week @ 2024-06-17 35/week @ 2024-06-24 30/week @ 2024-07-01 23/week @ 2024-07-08 45/week @ 2024-07-15 13/week @ 2024-07-22

113 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