4 releases (1 stable)

1.0.0 Aug 23, 2021
0.1.2 Aug 6, 2019
0.1.1 Aug 5, 2019
0.1.0 Aug 5, 2019

#52 in #unicode-characters

Download history 8609/week @ 2024-11-28 9507/week @ 2024-12-05 9649/week @ 2024-12-12 7692/week @ 2024-12-19 7782/week @ 2024-12-26 13371/week @ 2025-01-02 13722/week @ 2025-01-09 18195/week @ 2025-01-16 21497/week @ 2025-01-23 19390/week @ 2025-01-30 23812/week @ 2025-02-06 21179/week @ 2025-02-13 16985/week @ 2025-02-20 21623/week @ 2025-02-27 20504/week @ 2025-03-06 16326/week @ 2025-03-13

77,869 downloads per month
Used in 52 crates (7 directly)

MIT license

6KB
74 lines

comma

Crates.io docs.rs Build Status

comma splits shell-style commands, e.g. sendmsg joe "I say \"hi\" to you!", into a list of individual tokens. It correctly handles unicode characters, escape sequences, and single- or double-quoted strings.

Cargo

[dependencies]
comma = "1.0.0"

Usage

use comma::parse_command;

fn main () {
    let parsed = parse_command("sendmsg joe \"I say \\\"hi\\\" to you!\" 'but only\\ntoday'").unwrap();
    println!("Result: {:#?}", parsed); // Result: [ "sendmsg", "joe", "I say \"hi\" to you!", "but only\ntoday" ]
}

lib.rs:

comma parses command-line-style strings. See parse_command for details.

No runtime deps