UNPKG

projex

Version:
26 lines (25 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bashRunCommand = void 0; const _shared_1 = require("../../../../shared/index"); const utils_1 = require("./utils"); const _api_1 = require("../../../../api/index"); /** * The `bashRunCommand` function runs a specified bash command in all folders of the current directory * or in the selected folders, depending on the options provided. * @param command - The bash command to run. * @param options - An object that contains two properties: * - `l` or `list`: If true, lists all projects to select for running the command. */ const bashRunCommand = async (command, options) => { if (!command) { _shared_1.log.error(_api_1.Colors.ERROR('please provide a command to run')); process.exit(1); } const list = options.l || options.list; const utils = new utils_1.BashRunCommandUtils(command); const directory = await new _shared_1.DirectoryUtils(list); const folders = await directory.getFolders(); await directory.runCommandInFolders(folders, utils.run.bind(utils)); }; exports.bashRunCommand = bashRunCommand;