import yargs = require ( 'yargs' ) ; import { octokitFrom } from '../../utils/octokit-util' ; import { Validate } from '../../validate' ; interface Args { 'pem-path' : string ; 'app-id' : number ; installation : number ; } export const validApiShortNames = { command : 'valid-api-short-names' , describe : 'return list of valid API short-names based on service_xyz.yml files in file listing' , builder ( yargs ) { return yargs . option ( 'pem-path' , { describe : 'provide path to private key for requesting JWT' , type : 'string' , demand : true , } ) . option ( 'app-id' , { describe : 'GitHub AppID' , type : 'number' , demand : true , } ) . option ( 'installation' , { describe : 'installation ID for GitHub app' , type : 'number' , demand : true , } ) ; } , async handler ( argv ) { const octokit = await octokitFrom ( argv ) ; const validate = new Validate ( octokit ) ; const validApiShortNames = await validate . validApiShortNames ( ) ; console . info ( JSON . stringify ( Array . from ( validApiShortNames ) , null , 2 ) ) ; } , } ;