Skip to content

Commit

Permalink
chore: fix cli config
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Apr 28, 2020
1 parent a05c9dc commit 43febe1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/config/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<string, unknown>) => {
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;
}

0 comments on commit 43febe1

Please sign in to comment.