Fix bug in CombinedConfig: need to allow for config values not defined in the possible CLI args.
This commit is contained in:
parent
8036af6bc8
commit
e9351fbd9d
@ -15,7 +15,7 @@ proc getVal*(cfg: CombinedConfig, key: string): string =
|
|||||||
let envKey = key.replace('-', '_').toUpper
|
let envKey = key.replace('-', '_').toUpper
|
||||||
let jsonKey = key.replace(re"(-\w)", proc (m: RegexMatch): string = ($m)[1..1].toUpper)
|
let jsonKey = key.replace(re"(-\w)", proc (m: RegexMatch): string = ($m)[1..1].toUpper)
|
||||||
|
|
||||||
if cfg.docopt[argKey]: return $cfg.docopt[argKey]
|
if cfg.docopt.contains(argKey) and cfg.docopt[argKey]: return $cfg.docopt[argKey]
|
||||||
elif existsEnv(envKey): return getEnv(envKey)
|
elif existsEnv(envKey): return getEnv(envKey)
|
||||||
elif cfg.json.hasKey(jsonKey):
|
elif cfg.json.hasKey(jsonKey):
|
||||||
let node = cfg.json[jsonKey]
|
let node = cfg.json[jsonKey]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user