Crates.io | clargs |
lib.rs | clargs |
version | 1.0.0 |
source | src |
created_at | 2018-02-08 21:22:43.142086 |
updated_at | 2018-09-03 14:46:28.95226 |
description | A command-line arguments parsing library. |
homepage | |
repository | https://github.com/Zeldhoron/clargs |
max_upload_size | |
id | 50257 |
size | 71,554 |
Clargs is a library for parsing command-line arguments.
Parsing command-line arguments requires quite a bit of boilerplate code. This library remedies that for rust projects.
Before parsing an argument list a ParsingConfig
object must be configured.
It controls which features are enabled and how certain edge cases should be handled.
It is also used to add flags, parameters, subcommands and specify which parameters are required and other extra info.
Once configured, it can be used with the parse
function.
A flag is an option that has a name and does not require an argument. A named parameter is an option that has a name and that does require an argument. An unnamed parameter is an option that is neither a flag, a named parameter, nor an argument to a named parameter. An alias maps one name to an option that already has another name.
Options are identified by the name they were registered with. Aliases are only used during interpretation of the command-line arguments. As a result of this, they will never occur in the results or an error after parsing.
All option names and aliases can contain only lower and uppercase letters and hyphens.
Note that the first argument is always interpreted as the name of the command (or subcommand) which was invoked.