Config searches local directory as well, use CatchableError.

This commit is contained in:
2023-06-21 07:37:09 -05:00
parent b945534bd2
commit 0a49618ab3
3 changed files with 37 additions and 26 deletions

View File

@@ -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)