UNPKG

@aws-amplify/cli-internal

Version:
49 lines 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = void 0; const amplify_cli_core_1 = require("@aws-amplify/amplify-cli-core"); const amplify_prompts_1 = require("@aws-amplify/amplify-prompts"); const envUtils_1 = require("../helpers/envUtils"); const run = async (context) => { var _a, _b, _c, _d; const { envName } = context.amplify.getEnvInfo(); if ((_b = (_a = context === null || context === void 0 ? void 0 : context.parameters) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.details) { const allEnvs = context.amplify.getEnvDetails(); if (context.parameters.options.json) { amplify_prompts_1.printer.info(amplify_cli_core_1.JSONUtilities.stringify(allEnvs)); return; } Object.keys(allEnvs).forEach((env) => { amplify_prompts_1.printer.blankLine(); if (envName === env) { amplify_prompts_1.printer.info(`*${env}*`, 'red'); } else { amplify_prompts_1.printer.info(env, 'yellow'); } (0, envUtils_1.printEnvInfo)(env, allEnvs); }); } else { const allEnvs = context.amplify.getAllEnvs(); if ((_d = (_c = context === null || context === void 0 ? void 0 : context.parameters) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.json) { amplify_prompts_1.printer.info(amplify_cli_core_1.JSONUtilities.stringify({ envs: allEnvs })); return; } const { table } = context.print; const tableOptions = [['Environments']]; for (let i = 0; i < allEnvs.length; i += 1) { if (allEnvs[i] === envName) { tableOptions.push([`*${allEnvs[i]}`]); } else { tableOptions.push([allEnvs[i]]); } } amplify_prompts_1.printer.blankLine(); table(tableOptions, { format: 'markdown' }); amplify_prompts_1.printer.blankLine(); } }; exports.run = run; //# sourceMappingURL=list.js.map