smartcli
nimony/lib/std/smartcli.nim
Typed command-line parser generation from a help-text specification.
Use cliapp with a specification containing Commands:, Arguments:, and Options: sections. The accompanying compiler plugin generates a parser and a typed options object at the call site.
proc cliExitHelp(spec: string)proc cliExitVersion(spec: string)proc cliFail(spec: string; message: string)proc cliUnknownLongOption(spec: string; key: string)proc cliUnknownShortOption(spec: string; key: string)proc cliUnexpectedArgument(spec: string; arg: string)proc cliMissingArguments(spec: string)proc cliInvalidValue(spec: string; optionName: string; value: string)template cliapp(spec: string): untypedtemplate cliapp(spec: string; args: seq): untypedParses
argsinstead of the process command line.argsholds the arguments only — no program name — exactly like the sequence overload ofparseopt.initOptParser, which is what the generated parser calls.