clip

Crates.ioclip
lib.rsclip
version0.1.1
sourcesrc
created_at2019-08-13 18:13:03.079025
updated_at2019-08-13 18:17:16.047046
descriptionA command line parser that doesn't use std or alloc!
homepage
repository
max_upload_size
id156523
size20,741
adam mcdaniel (adam-mcdaniel)

documentation

README

clip

A command line parser that doesn't use std or alloc!

Why?

I mainly did this for educational purposes. I've never written a library that did not use the std or alloc crates, so I wanted to learn how.

I also think the portability of this crate will be useful in implementing Rusty-CI

Example

extern crate clip;

use clip::App;
use std::env::args;


fn main() {
    let strings = &args().collect::<Vec<String>>()[..];
    let values: Vec<&str> = strings.iter().map(|s| &**s).collect();


    let mut app = App::new(&values[1..])
                .name("name")
                .flag("--input", 1)
                .flag("--output", 1)
                .flag("--link", -1)
                ;
    app.parse();

    println!(
        "name: {}\ninput: {}\noutput: {}\nlink: {:?}",
        app.get("name")[0],
        app.get("--input")[0],
        app.get("--output")[0],
        app.get("--link"),
    )
}
Commit count: 0

cargo fmt