Compare commits

..

No commits in common. "main" and "0.9.0" have entirely different histories.
main ... 0.9.0

3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Package # Package
version = "0.9.1" version = "0.9.0"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Helper functions for writing command line interfaces." description = "Helper functions for writing command line interfaces."
license = "MIT" license = "MIT"

View File

@ -6,13 +6,13 @@ type
docopt*: Table[string, Value] docopt*: Table[string, Value]
json*: JsonNode json*: JsonNode
proc keyNames(key: string): tuple[arg, env, json: string] {.raises: [KeyError].} = func keyNames(key: string): tuple[arg, env, json: string] {.raises: [KeyError].} =
try: try:
result = ( result = (
"--" & key, "--" & key,
key.replace('-', '_').toUpper, key.replace('-', '_').toUpper,
key.replace(re"(-\w)", proc (m: RegexMatch): string = ($m)[1..1].toUpper)) key.replace(re"(-\w)", proc (m: RegexMatch): string = ($m)[1..1].toUpper))
except Exception: except CatchableError:
raise newException(KeyError, "invalid config key: '" & key & "'") raise newException(KeyError, "invalid config key: '" & key & "'")
template walkFieldDefs*(t: NimNode, body: untyped) = template walkFieldDefs*(t: NimNode, body: untyped) =

View File

@ -47,7 +47,7 @@ proc exec*(command: string, workingDir: string = "",
args: openArray[string] = [], env: StringTableRef = nil, args: openArray[string] = [], env: StringTableRef = nil,
options: set[ProcessOption] = {poUsePath}, options: set[ProcessOption] = {poUsePath},
msgCB: HandleProcMsgCB = nil): int msgCB: HandleProcMsgCB = nil): int
{.tags: [ExecIOEffect, ReadIOEffect, RootEffect].} = {.tags: [ExecIOEffect, ReadIOEffect, RootEffect], gcsafe.} =
var p = startProcess(command, workingDir, args, env, options) var p = startProcess(command, workingDir, args, env, options)
result = waitFor(p, msgCB, command) result = waitFor(p, msgCB, command)