#parser #arguments-parser #cli-parser #command #command-line-arguments #argv #clier

clier_parser

Parser for building values and commands from command line arguments

7 releases

0.7.4 May 6, 2024
0.7.3 Oct 2, 2023
0.7.2 Sep 30, 2023
0.6.2 Sep 28, 2023

#1187 in Command-line interface

Download history 1/week @ 2024-11-13 2/week @ 2024-11-20 5/week @ 2024-12-04 20/week @ 2024-12-11 3/week @ 2024-12-18 3/week @ 2025-01-08 5/week @ 2025-01-29 9/week @ 2025-02-05 29/week @ 2025-02-12 19/week @ 2025-02-26

58 downloads per month
Used in 4 crates (via clier)

Custom license

12KB
255 lines

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"
  }
 }

Dependencies

~485KB