import ExecuteCommand from "./commandExecutor/ExecuteCommand" ; import SFPLogger , { Logger , LoggerLevel } from "../logger/SFPLogger" ; export abstract class SFDXCommand { public constructor ( protected target_org , protected project_directory , protected logger ? , protected logLevel ? ) { } public async exec ( quiet = true , timeout = 0 , showProgress = false ) { let command = this . getSFDXCommand ( ) ; if ( quiet ) command += ` --json` ; command += " " + this . getGeneratedParams ( ) ; SFPLogger . log ( "Generated Command:" + command , LoggerLevel . TRACE , this . logger ) ; let executor = new ExecuteCommand ( this . logger , this . logLevel , showProgress ) ; let output = await executor . execCommand ( command , this . project_directory , timeout , quiet ) ; if ( quiet ) { return JSON . parse ( output ) . result ; } return output ; } public getGeneratedSFDXCommandWithParams ( ) { let command = this . getSFDXCommand ( ) ; command += " " + this . getGeneratedParams ( ) ; return command ; } abstract getSFDXCommand ( ) ; abstract getCommandName ( ) ; abstract getGeneratedParams ( ) ; }