Closed ZoomRmc closed 1 year ago
Does the shortcircuit
arg to flag
do what you want? https://github.com/iffy/nim-argparse/blob/master/src/argparse.nim#L143
If not, can you provide an example of how you'd like it to look?
Ouch, I'm so sorry, don't know how I missed it.
flag("-v", "--version", help="Print version and exit"
and except ShortCircuit as err: (if err.flag == "version": echo versionConst
) completely covers it.
A user defined error flag for short-circuiting, such as
"argparse_help"
would be nice, as it could allow react to a flag/command. Currently it looks like you can't ignore the absence of positional arguments and act on a flag, such as-v
/--version
. At the very least a hardcoded "argparse_version" is enough to get by.