Config searches local directory as well, use CatchableError.
This commit is contained in:
15
cliutils.nim
15
cliutils.nim
@@ -27,7 +27,7 @@ proc stripAnsi*(str: string): string =
|
||||
let STRIP_ANSI_REGEX = re"\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]"
|
||||
return str.replace(STRIP_ANSI_REGEX, "")
|
||||
|
||||
proc queryParamsToCliArgs*(queryParams: Table[string, string]): seq[string] =
|
||||
proc doParseQueryParams[T](queryParams: T): seq[string] =
|
||||
result = @[]
|
||||
|
||||
for k,v in queryParams:
|
||||
@@ -38,13 +38,8 @@ proc queryParamsToCliArgs*(queryParams: Table[string, string]): seq[string] =
|
||||
result.add("--" & k)
|
||||
if v != "true": result.add(v) # support things like ?verbose=true -> cmd --verbose
|
||||
|
||||
proc queryParamsToCliArgs*(queryParams: Table[string, string]): seq[string] =
|
||||
doParseQueryParams(queryParams)
|
||||
|
||||
proc queryParamsToCliArgs*(queryParams: StringTableRef): seq[string] =
|
||||
result = @[]
|
||||
|
||||
for k,v in queryParams:
|
||||
# support ?arg1=val1&arg2=val2 -> cmd val1 val2
|
||||
if k.startsWith("arg"): result.add(v)
|
||||
|
||||
else :
|
||||
result.add("--" & k)
|
||||
if v != "true": result.add(v) # support things like ?verbose=true -> cmd --verbose
|
||||
doParseQueryParams(queryParams)
|
||||
|
||||
Reference in New Issue
Block a user