@@ -270,6 +270,7 @@ const commandOptions = commander.opts<ICommanderOptions>();
270270 name : string ,
271271 description : string ,
272272 action : ( repositoryOwner : string , pullRequestURL : string ) => Promise < void > ,
273+ verbatim2ndArgument = false ,
273274 ) {
274275 super ( name ) ;
275276 super . argument ( "[repository-owner]" ) ;
@@ -281,9 +282,10 @@ const commandOptions = commander.opts<ICommanderOptions>();
281282 args [ 0 ] = config . repo . owner ;
282283 }
283284 const [ repositoryOwner , prNumber ] = args ;
284- const pullRequestURL = prNumber . match ( / ^ h t t p / )
285- ? prNumber
286- : `https://github.com/${ repositoryOwner } /${ config . repo . name } /pull/${ prNumber } ` ;
285+ const pullRequestURL =
286+ verbatim2ndArgument || prNumber . match ( / ^ h t t p / )
287+ ? prNumber
288+ : `https://github.com/${ repositoryOwner } /${ config . repo . name } /pull/${ prNumber } ` ;
287289 return await action ( repositoryOwner , pullRequestURL ) ;
288290 } ) ;
289291 }
@@ -311,9 +313,7 @@ const commandOptions = commander.opts<ICommanderOptions>();
311313 new OptionalRepoOwnerCommand (
312314 "get-pr-commits" ,
313315 "Get the commits for a given Pull Request" ,
314- async ( repositoryOwner , prNumber ) => {
315- if ( repositoryOwner === undefined ) repositoryOwner = config . repo . owner ;
316- const pullRequestURL = `https://github.com/${ repositoryOwner } /${ config . repo . name } /pull/${ prNumber } ` ;
316+ async ( _repositoryOwner , pullRequestURL ) => {
317317 const prMeta = await ci . getPRMetadata ( pullRequestURL ) ;
318318 if ( ! prMeta ) {
319319 throw new Error ( `No metadata found for ${ pullRequestURL } ` ) ;
@@ -326,10 +326,7 @@ const commandOptions = commander.opts<ICommanderOptions>();
326326 new OptionalRepoOwnerCommand (
327327 "handle-pr" ,
328328 "Handle a given Pull Request (add it to open PRs, update commit <-> message ID mapping, etc.)" ,
329- async ( repositoryOwner , prNumber ) => {
330- if ( repositoryOwner === undefined ) repositoryOwner = config . repo . owner ;
331- const pullRequestURL = `https://github.com/${ repositoryOwner } /${ config . repo . name } /pull/${ prNumber } ` ;
332-
329+ async ( _repositoryOwner , pullRequestURL ) => {
333330 const meta = await ci . getPRMetadata ( pullRequestURL ) ;
334331 if ( ! meta ) {
335332 throw new Error ( `No metadata for ${ pullRequestURL } ` ) ;
@@ -441,20 +438,21 @@ const commandOptions = commander.opts<ICommanderOptions>();
441438 new OptionalRepoOwnerCommand (
442439 "handle-pr-comment" ,
443440 "Handle a comment on a Pull Request" ,
444- async ( repositoryOwner : string | undefined , commentID : string ) => {
441+ async ( repositoryOwner : string , commentID : string ) => {
445442 if ( repositoryOwner === undefined ) repositoryOwner = config . repo . owner ;
446443 await ci . handleComment ( repositoryOwner , parseInt ( commentID , 10 ) ) ;
447444 } ,
445+ true ,
448446 ) ,
449447 ) ;
450448 commander . addCommand (
451449 new OptionalRepoOwnerCommand (
452450 "handle-pr-push" ,
453451 "Handle a push to a Pull Request" ,
454- async ( repositoryOwner : string | undefined , prNumber : string ) => {
455- if ( repositoryOwner === undefined ) repositoryOwner = config . repo . owner ;
452+ async ( repositoryOwner : string , prNumber : string ) => {
456453 await ci . handlePush ( repositoryOwner , parseInt ( prNumber , 10 ) ) ;
457454 } ,
455+ true ,
458456 ) ,
459457 ) ;
460458 commander
0 commit comments