| 
									
										
										
										
											2020-05-11 15:21:18 -07: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} from 'yargs'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-01 10:39:35 +02:00
										 |  |  | import {addGithubTokenOption} from '../../utils/git/github-yargs'; | 
					
						
							| 
									
										
										
										
											2020-05-20 14:32:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-11 15:21:18 -07:00
										 |  |  | import {rebasePr} from './index'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-14 12:20:55 -07:00
										 |  |  | /** The options available to the rebase command via CLI. */ | 
					
						
							|  |  |  | export interface RebaseCommandOptions { | 
					
						
							| 
									
										
										
										
											2020-08-28 11:45:01 -07:00
										 |  |  |   githubToken: string; | 
					
						
							| 
									
										
										
										
											2020-08-14 12:20:55 -07:00
										 |  |  |   prNumber: number; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-11 15:21:18 -07:00
										 |  |  | /** Builds the rebase pull request command. */ | 
					
						
							| 
									
										
										
										
											2020-08-14 12:20:55 -07:00
										 |  |  | export function buildRebaseCommand(yargs: Argv): Argv<RebaseCommandOptions> { | 
					
						
							| 
									
										
										
										
											2020-09-01 10:39:35 +02:00
										 |  |  |   return addGithubTokenOption(yargs).positional('prNumber', {type: 'number', demandOption: true}); | 
					
						
							| 
									
										
										
										
											2020-05-11 15:21:18 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** Handles the rebase pull request command. */ | 
					
						
							| 
									
										
										
										
											2020-08-28 11:45:01 -07:00
										 |  |  | export async function handleRebaseCommand( | 
					
						
							|  |  |  |     {prNumber, githubToken}: Arguments<RebaseCommandOptions>) { | 
					
						
							|  |  |  |   await rebasePr(prNumber, githubToken); | 
					
						
							| 
									
										
										
										
											2020-05-11 15:21:18 -07:00
										 |  |  | } |