file copyright author Vivek M. Chawla <@VivekMChawla>
 *  summary description version license import { flags } from '@salesforce/command' ; import { Messages } from '@salesforce/core' ; import { SfdxError } from '@salesforce/core' ; import { AnyJson } from '@salesforce/ts-types' ; import { SfdxFalconError } from '../../../modules/sfdx-falcon-error' ; import { isGitUriValid } from '../../../modules/sfdx-falcon-util/git' ; import { SfdxFalconYeomanCommand } from '../../../modules/sfdx-falcon-yeoman-command' ; import { SfdxFalconCommandType } from '../../../modules/sfdx-falcon-command' ; const dbgNs = 'COMMAND:falcon-adk-clone:' ; Messages . importMessagesDirectory ( __dirname ) ; const baseMessages = Messages . loadMessages ( 'sfdx-falcon' , 'sfdxFalconCommand' ) ; const commandMessages = Messages . loadMessages ( 'sfdx-falcon' , 'falconAdkClone' ) ; class extends SfdxFalconYeomanCommand summary description public export default class FalconAdkClone extends SfdxFalconYeomanCommand { public static description = commandMessages . getMessage ( 'commandDescription' ) ; public static hidden = false ; public static examples = [ `$ sfdx falcon:adk:clone https://github.com/GitHubUser/my-repository.git` , `$ sfdx falcon:adk:clone https://github.com/GitHubUser/my-repository.git MyRepoDirName` , `$ sfdx falcon:adk:clone https://github.com/GitHubUser/my-repository.git MyRepoDirName \\\n` + `                       --outputdir ~/demos/appexchange-demo-kit-projects` ] ; public static args = [ { name : 'GIT_REMOTE_URI' , description : baseMessages . getMessage ( 'gitRemoteUri_ArgDescription' ) , required : true , hidden : false } , { name : 'GIT_CLONE_DIR' , description : baseMessages . getMessage ( 'gitCloneDir_ArgDescription' ) , required : false , hidden : false } ] ; protected static flagsConfig = { outputdir : flags . directory ( { char : 'd' , required : false , description : commandMessages . getMessage ( 'outputdir_FlagDescription' ) , default : '.' , hidden : false } ) , ... SfdxFalconYeomanCommand . falconBaseflagsConfig } ; protected static requiresProject = false ; protected static requiresUsername = false ; protected static requiresDevhubUsername = false ; protected static supportsUsername = false ; protected static supportsDevhubUsername = false ; method returns { Promise < AnyJson > } description public async public async run ( ) { this . sfdxFalconCommandInit ( 'falcon:adk:clone' , SfdxFalconCommandType . APPX_DEMO ) ; if ( isGitUriValid ( this . gitRemoteUri ) === false ) { throw new SfdxFalconError ( `The value '${ this . gitRemoteUri }' is not a valid Git Remote URI.` , `InvalidGitUri` , `${ dbgNs }run` ) ; } if ( this . gitRemoteUri . substr ( 0 , 8 ) !== 'https://' ) { throw new SfdxFalconError ( `Git Remote URI must use the https protocol (ex. 'https://github.com/GitHubUser/my-repository.git')` , `InvalidGitUriProtocol` , `${ dbgNs }run` ) ; } await super . runYeomanGenerator ( { generatorType : 'clone-appx-demo-project' , gitRemoteUri : this . gitRemoteUri , outputDir : this . outputDirectory , gitCloneDir : this . gitCloneDirectory , options : [ ] } ) . then ( generatorResult => this . onSuccess ( generatorResult ) ) . catch ( generatorResult => this . onError ( generatorResult ) ) ; return this . falconJsonResponse as unknown as AnyJson ; } method param { SfdxFalconError } cmdError returns { SfdxError } description protected protected buildFinalError ( cmdError ) { return cmdError ; } }