From e9351fbd9da5ed5fb55bf82f3c3b68111913403a Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 18 Feb 2019 16:06:10 -0600 Subject: [PATCH] Fix bug in CombinedConfig: need to allow for config values not defined in the possible CLI args. --- cliutils.nim | 2 +- cliutils.nimble | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cliutils.nim b/cliutils.nim index ef7f62c..9c96713 100644 --- a/cliutils.nim +++ b/cliutils.nim @@ -15,7 +15,7 @@ proc getVal*(cfg: CombinedConfig, key: string): string = let envKey = key.replace('-', '_').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 cfg.json.hasKey(jsonKey): let node = cfg.json[jsonKey] diff --git a/cliutils.nimble b/cliutils.nimble index 0427e88..9426352 100644 --- a/cliutils.nimble +++ b/cliutils.nimble @@ -1,6 +1,6 @@ # Package -version = "0.6.2" +version = "0.6.3" author = "Jonathan Bernard" description = "Helper functions for writing command line interfaces." license = "MIT"