UNPKG

sda

Version:

Software development assistant

37 lines 1.41 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const easy_table_1 = __importDefault(require("easy-table")); const getEnvironment_1 = require("../getEnvironment"); const Log_1 = __importDefault(require("../Log")); function listCommands(ec) { if (ec.runInAllEnvironments) { Log_1.default.verbose('List commands for all environments'); const envs = getEnvironment_1.getAllEnvironments(ec.config); envs.forEach((env) => { console.log(`Environment: ${env.id}`); listEnvCommands(env); }); } else { Log_1.default.verbose(`List commands for environment "${ec.env.id}" with template "${ec.env.templateId}"`); listEnvCommands(ec.env); } } exports.default = listCommands; function listEnvCommands(env) { const template = env.template; const table = new easy_table_1.default(); Object.keys(template.commands).forEach((cmdId) => { table.cell('Command', cmdId); const cmd = template.commands[cmdId]; if (cmd.description) { table.cell('Description', cmd.description); } table.newRow(); }); console.log(table.toString()); } //# sourceMappingURL=listCommands.js.map