Helper utility for parsing simple commandline arguments.
This is not intended to be a complete commandline parser library. Instead this can be used as an alternative quick-and-dirty approach that can be cheaply incorporated into a tool.
We provide: * A dependency-free commandline parsing framework using declarative macros. So it's hopefully lightweight and compiles quickly. * A flexible mechanism for parsing. * Formatting decent looking help messages.
We specifically do not support:
* As-close-to correct line wrapping with wide unicode characters as possible
(see [textwrap]).
* Required arguments. If your argument is required, you'll have to
[okorelse] it yourself from an Option<T>
.
* Complex command structures like subcommands.
For a more complete commandline parsing library, use [clap].
See the documentation for [argwerk::parse!] for how to use.
This is available as a runnable example:
sh cargo run --example tour
```rust
let args = argwerk::parse! {
/// A command touring the capabilities of argwerk.
"tour [-h]" {
help: bool,
file: Option
if args.help { println!("{}", args.help()); }
dbg!(args); ```
License: MIT/Apache-2.0