Crates.io | clier_parser |
lib.rs | clier_parser |
version | 0.7.4 |
source | src |
created_at | 2023-09-28 22:03:15.937083 |
updated_at | 2024-05-06 15:57:27.85435 |
description | Parser for building values and commands from command line arguments |
homepage | |
repository | https://github.com/vincent-thomas/clier |
max_upload_size | |
id | 986733 |
size | 32,655 |
clier_parser
is a command line argument parser for rust.
To start a new cli projects run:
$ cargo new demo && cd demo
$ cargo add clier_parser
Then define your CLI in src/main.rs
:
use std::env::args;
use clier_parser::Argv;
let args: Vec<String> = args().collect();
let parsed = Argv::from(args.as_slice());
println!("{:#?}", parsed);
And try it out:
$ cargo run -- command subcommand -tfv testing --test=value --no-production --help
Argv {
commands: [
"command",
"subcommand",
],
flags: {
"test": "value",
"production": "false",
"help": "true",
"try-me": "false",
"t": "true",
"f": "true",
"v": "testing"
}
}