2020-10-28 20:14:40 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {Arguments, Argv, CommandModule} from 'yargs';
|
|
|
|
|
2020-11-30 17:53:05 -05:00
|
|
|
import {printTargetBranchesForPr} from './check-target-branches';
|
2020-10-28 20:14:40 -04:00
|
|
|
|
|
|
|
export interface CheckTargetBranchesOptions {
|
|
|
|
pr: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Builds the command. */
|
|
|
|
function builder(yargs: Argv) {
|
2020-11-30 17:53:05 -05:00
|
|
|
return yargs.positional('pr', {
|
|
|
|
description: 'The pull request number',
|
|
|
|
type: 'number',
|
|
|
|
demandOption: true,
|
|
|
|
});
|
2020-10-28 20:14:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Handles the command. */
|
2020-11-30 17:53:05 -05:00
|
|
|
async function handler({pr}: Arguments<CheckTargetBranchesOptions>) {
|
|
|
|
await printTargetBranchesForPr(pr);
|
2020-10-28 20:14:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** yargs command module describing the command. */
|
|
|
|
export const CheckTargetBranchesModule: CommandModule<{}, CheckTargetBranchesOptions> = {
|
|
|
|
handler,
|
|
|
|
builder,
|
|
|
|
command: 'check-target-branches <pr>',
|
|
|
|
describe: 'Check a PR to determine what branches it is currently targeting',
|
|
|
|
};
|