Update mergify to use commands instead of options

This commit is contained in:
Julien Lengrand-Lambert
2018-04-27 10:40:04 +02:00
committed by Ramon Gebben
parent e6190d9786
commit db31cd72d7

View File

@@ -15,24 +15,24 @@ program
.name('mergify')
.version(pack.version);
const options = [
const commands = [
{
trigger: '-a --assigned',
trigger: 'assigned',
description: 'Get all open merge request assigned to you',
fn: getAllAssigned
},
{
trigger: '-s --submitted',
trigger: 'submitted',
description: 'Get all open merge request submitted to you',
fn: getAllSubmitted
},
{
trigger: '-c --configure',
trigger: 'configure',
description: 'Setup or update required config',
fn: configure
},
{
trigger: '-v --verify',
trigger: 'verify',
description: 'Verify your config is correct',
fn: verify
}
@@ -52,8 +52,11 @@ const run = async() => {
await verify();
}
options.forEach(({ trigger, description, fn }) => {
program.option(trigger, description, (...args) => fn(config, ...args));
commands.forEach(({ trigger, description, fn }) => {
program
.command(trigger)
.description(description)
.action((...args) => fn(config, ...args));
});
return program;