9 releases
new 0.1.8 | Jun 15, 2025 |
---|---|
0.1.7 | Jun 15, 2025 |
0.1.3 | May 2, 2025 |
0.1.2 | Apr 4, 2025 |
0.1.1 | Mar 15, 2025 |
#496 in Command-line interface
319 downloads per month
18KB
387 lines
Using macros to concisely define the getopts
use getopts_macro::getopts_options;
let _options = getopts_options! {
-z --zero "...";
-v --verbose* "...";
-T --threads=NUM "...";
-i --ignore*=FILE "...";
-h --help* "...";
-V --version* "...";
};
Expand to:
let _options = {
let mut options = getopts::Options::new();
options.optflag("z", "zero", "...");
options.optflagmulti("v", "verbose", "...");
options.optopt("T", "threads", "...", "NUM");
options.optmulti("i", "ignore", "...", "FILE");
options.optflagmulti("h", "help", "...");
options.optflagmulti("V", "version", "...");
options
};
Dependencies
~1.5MB
~24K SLoC