sfdx-hardis
Version:
Swiss-army-knife Toolbox for Salesforce. Allows you to define a complete CD/CD Pipeline. Orchestrate base commands and assist users with interactive wizards
29 lines • 1.27 kB
JavaScript
import { ActionsProvider } from './actionsProvider.js';
import { execCommand, uxLog } from '../utils/index.js';
import c from 'chalk';
export class CommandAction extends ActionsProvider {
getLabel() {
return 'CommandAction';
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async checkParameters(cmd) {
const command = cmd.command;
if (!command) {
uxLog('error', this, c.red(`[DeploymentActions] No command provided for action [${cmd.id}]: ${cmd.label}`));
return { statusCode: 'failed', skippedReason: 'No command provided' };
}
return null;
}
async run(cmd) {
const validity = await this.checkValidityIssues(cmd);
if (validity)
return validity;
cmd.command = cmd.command + (this.customUsernameToUse ? ` --target-org ${this.customUsernameToUse}` : '');
const res = await execCommand(cmd.command, null, { fail: false, output: true });
if (res.status === 0) {
return { statusCode: 'success', output: (res.stdout || '') + '\n' + (res.stderr || '') };
}
return { statusCode: 'failed', output: (res.stdout || '') + '\n' + (res.stderr || '') };
}
}
//# sourceMappingURL=commandAction.js.map