diff --git a/lib/config/cli.ts b/lib/config/cli.ts index bf40d0fe35ea2d..b15ec0fb32a9a0 100644 --- a/lib/config/cli.ts +++ b/lib/config/cli.ts @@ -70,7 +70,10 @@ export function getConfig(input: string[]): RenovateCliConfig { integer: parseInt, }; - let program = new Command().arguments('[repositories...]'); + let program = new Command() + .storeOptionsAsProperties(false) + .passCommandToAction(false) + .arguments('[repositories...]'); options.forEach((option) => { if (option.cli !== false) { @@ -103,20 +106,20 @@ export function getConfig(input: string[]): RenovateCliConfig { program = program .version(version, '-v, --version') .on('--help', helpConsole) - .action((repositories) => { + .action((repositories: string[], opts: Record) => { if (repositories && repositories.length) { config.repositories = repositories; } - }) - .parse(argv); - options.forEach((option) => { - if (option.cli !== false) { - if (program[option.name] !== undefined) { - config[option.name] = program[option.name]; + for (const option of options) { + if (option.cli !== false) { + if (opts[option.name] !== undefined) { + config[option.name] = opts[option.name]; + } + } } - } - }); + }) + .parse(argv); return config; } diff --git a/package.json b/package.json index 63ea0fbfac7813..0fe9ad67ab6387 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "chalk": "4.0.0", "changelog-filename-regex": "2.0.1", "clean-git-ref": "2.0.1", - "commander": "5.0.0", + "commander": "5.1.0", "conventional-commits-detector": "1.0.2", "convert-hrtime": "3.0.0", "deepmerge": "4.2.2", diff --git a/tools/package.json b/tools/package.json index 30479762b97916..ca036afd8b2052 100644 --- a/tools/package.json +++ b/tools/package.json @@ -5,7 +5,7 @@ "@actions/core": "1.2.3", "@jest/reporters": "25.4.0", "@jest/test-result": "25.4.0", - "commander": "5.0.0", + "commander": "5.1.0", "eslint": "6.8.0", "fs-extra": "9.0.0", "got": "9.6.0", diff --git a/yarn.lock b/yarn.lock index 61fbd031e86130..d14a5a88c38603 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2719,10 +2719,10 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-5.0.0.tgz#dbf1909b49e5044f8fdaf0adc809f0c0722bdfd0" - integrity sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ== +commander@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" + integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== commander@^4.0.1: version "4.1.1"