Skip to content

Instantly share code, notes, and snippets.

View kovalensky's full-sized avatar

Cønstantine kovalensky

  • Karelia
View GitHub Profile
@nervecenter
nervecenter / simpleargs.nim
Last active October 25, 2025 01:56
A simple set of CLI argument parsing procedures using std/parseopt that covers the majority of basic cases for parsing CLI arguments.
# by Chris Collazo
# Released to the public domain
import std/parseopt
# `short` is optional
proc get_option*(oparser: var OptParser, name: string, default: string, short: string = ""): string =
for kind, key, val in oparser.getopt():
if kind == cmdLongOption and key == name:
return val