mirror of
https://github.com/squattingmonk/blarg
synced 2026-01-15 13:01:45 +00:00
No description
| .github/workflows | ||
| examples | ||
| src | ||
| tests | ||
| .gitignore | ||
| blarg.nimble | ||
| config.nims | ||
| LICENSE | ||
| README.md | ||
blarg
A basic little argument parser for command-line tools.
Forked from cligen's parseopt3 module.
Requirements
- nim >= 1.6.0
Installation
$ nimble install blarg
or...
$ git clone https://github.com/squattingmonk/blarg.git
$ cd blarg
$ nimble install
Usage
In most cases, blarg can be used as a drop-in replacement for std/parseopt:
import blarg
for kind, key, val in getopt():
case kind
of cmdArgument:
echo "got argument ", key
of cmdShortOption, cmdLongOption:
echo "got option ", key, " = ", val
else:
assert false # Cannot happen
For detailed usage, see the docs.
Features
- Separator characters may be required or optional, and may be customized. If
optional, short or long options that do not expect a value must be specified
in
shortNoValandlongNoValrespectively. - Supports operator characters before separators (e.g.,
--foo+=bar) - Supports
--and custom stop words, which treat any following options as arguments. - Stop words and long options that do not expect a value can be normalized
(e.g., normalizing with
strutils.normalizemakes--foobarmatch--fooBar). The normalizing proc is optional and customizable, unlikecligen/parseopt3.
TODO
- Add more examples for advanced usage