#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

#14 in #cmd-line

Download history 23/week @ 2024-10-01 10/week @ 2024-10-08 9/week @ 2024-10-15 44/week @ 2024-10-22 62/week @ 2024-10-29 15/week @ 2024-11-05 31/week @ 2024-11-12 32/week @ 2024-11-19 54/week @ 2024-11-26 17/week @ 2024-12-03 53/week @ 2024-12-10 19/week @ 2024-12-17 23/week @ 2025-01-07 33/week @ 2025-01-14

56 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