@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
29 lines (28 loc) • 820 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.runCommand = void 0;
const programmatic_1 = require("../adapters/programmatic");
/**
* Run a command programmatically.
* This is the main entry point for calling commands from code.
*
* @example
* ```ts
* import { commandPortForward } from "./commands/project/portForward";
* import { runCommand } from "./core/runner";
*
* await runCommand(commandPortForward, {
* inputs: { envComponent: "dev:web", podName: "web-abc", localPort: 3000, remotePort: 3000 },
* });
* ```
*/
async function runCommand(command, options = {}) {
const ctx = (0, programmatic_1.createProgrammaticContext)(command, {
inputs: options.inputs,
onLog: options.onLog
});
await command.execute(ctx);
}
exports.runCommand = runCommand;