"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const execa_1 = __importDefault(require("execa"));
exports.default = {
    name: "run",
    description: "run shell command",
    aliases: [],
    args: {
        command: {
            type: "string",
        },
    },
    visibleInList: false,
    async run({ args, utils }) {
        const chalk = utils.color();
        console.log(`${chalk.green("running")} > ${chalk.gray(args.command)}`);
        const [main, ...others] = args.command.split(" ");
        try {
            const res = await execa_1.default(main, others, {
                env: { extendEnv: true, FORCE_COLOR: true },
            });
            console.log(res.stdout);
        }
        catch (e) {
            console.log(`${chalk.red("Error")} > ${chalk.gray(e.message)}`);
            throw e;
        }
    },
};
