clier_parser

Crates.ioclier_parser
lib.rsclier_parser
version0.7.4
sourcesrc
created_at2023-09-28 22:03:15.937083
updated_at2024-05-06 15:57:27.85435
descriptionParser for building values and commands from command line arguments
homepage
repositoryhttps://github.com/vincent-thomas/clier
max_upload_size
id986733
size32,655
Vincent Thomas (vincent-thomas)

documentation

https://docs.rs/clier_parser

README

Command Line Argument Parser for Rust

clier_parser is a command line argument parser for rust.

Parser

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"
  }
 }
Commit count: 71

cargo fmt