Crates.io | pareg |
lib.rs | pareg |
version | 0.5.2 |
source | src |
created_at | 2024-04-18 20:37:46.15032 |
updated_at | 2024-10-25 09:05:23.901323 |
description | Rust library with useful tools for command line argument parsing |
homepage | https://github.com/BonnyAD9/pareg |
repository | https://github.com/BonnyAD9/pareg |
max_upload_size | |
id | 1212887 |
size | 18,599 |
Helpful utilities for parsing command line arguments.
The aim of this crate is not to automate parsing of command line arguments because there are many ways to construct a CLI for your application and universal parser is not would be as hard to use as just writing it yourself. Instead this crate provides useful types and parsing funcitonality to make the process of writing your own code to parse command line arguments as simple as possible: It provides special struct for parsing the arguments in various ways and plenty of useful parsing functions and macros. Everything is made to minimize the repetetive part of the code for parsing the arguments and providing very user friendly error messages out of the box. If you wan't to see examples see docs.
Pareg
: istruct that will help with parsing of arguments.FromArg
: trait simmilar to FromStr
. It is used by all the parsing
functionality in this crate. There is also simple derive macro for enums.
FromStr
and there is simple trait to just mark FromStr
implementation
as also FromArg
: FromArgStr
.starts_any
and has_any_key
: useful for checking argument types.argument error: Unknown option `no`.
--> arg1:8..10
|
$ my-program --color=no
| ^^ Unknown option.
hint: Valid options are: `auto`, `always`, `never`.
Documentation and examples are available at the docs.
It is available on crates.io:
cargo add pareg
[dependencies]
pareg = "0.1.0"