diff --git a/tests/integration/codexconfig.nim b/tests/integration/codexconfig.nim index 9c1d3064..0e8a2434 100644 --- a/tests/integration/codexconfig.nim +++ b/tests/integration/codexconfig.nim @@ -22,7 +22,6 @@ type CodexConfig* = object cliOptions: Table[StartUpCmd, Table[string, CliOption]] cliPersistenceOptions: Table[PersistenceCmd, Table[string, CliOption]] - parsedCli: CodexConf debugEnabled*: bool CodexConfigError* = object of CatchableError @@ -47,9 +46,9 @@ proc checkBounds(self: CodexConfigs, idx: int) {.raises: [CodexConfigError].} = if idx notin 0.. 0: @@ -57,8 +56,7 @@ proc validateCliArgs( else: "" try: - config.parsedCli = CodexConf.load(cmdLine = config.cliArgs, - quitOnFailure = false) + return CodexConf.load(cmdLine = config.cliArgs, quitOnFailure = false) except ConfigurationError as e: raiseCodexConfigError msg & e.msg.postFix except Exception as e: @@ -73,7 +71,7 @@ proc addCliOption*( var options = config.cliPersistenceOptions.getOrDefault(group) options[cliOption.key] = cliOption # overwrite if already exists config.cliPersistenceOptions[group] = options - config.validateCliArgs("Invalid cli arg " & $cliOption) + discard config.buildConfig("Invalid cli arg " & $cliOption) proc addCliOption*( config: var CodexConfig, @@ -90,7 +88,7 @@ proc addCliOption*( var options = config.cliOptions.getOrDefault(group) options[cliOption.key] = cliOption # overwrite if already exists config.cliOptions[group] = options - config.validateCliArgs("Invalid cli arg " & $cliOption) + discard config.buildConfig("Invalid cli arg " & $cliOption) proc addCliOption*( config: var CodexConfig, @@ -135,11 +133,13 @@ proc cliArgs*( return args proc logFile*(config: CodexConfig): ?string {.raises: [CodexConfigError].} = - config.parsedCli.logFile + let built = config.buildConfig("Invalid codex config cli params") + built.logFile proc logLevel*(config: CodexConfig): LogLevel {.raises: [CodexConfigError].} = convertError: - return parseEnum[LogLevel](config.parsedCli.logLevel.toUpperAscii) + let built = config.buildConfig("Invalid codex config cli params") + return parseEnum[LogLevel](built.logLevel.toUpperAscii) proc debug*( self: CodexConfigs, @@ -245,7 +245,8 @@ proc logLevelWithTopics( convertError: var logLevel = LogLevel.INFO - logLevel = parseEnum[LogLevel](config.parsedCli.logLevel.toUpperAscii) + let built = config.buildConfig("Invalid codex config cli params") + logLevel = parseEnum[LogLevel](built.logLevel.toUpperAscii) let level = $logLevel & ";TRACE: " & topics.join(",") return level