@forge/cli
12.23.0-next.7-experimental-44b7a1213.0.0-next.11
out/command-line/controller/module-show-controller.js+
out/command-line/controller/module-show-controller.jsNew file+40
Index: package/out/command-line/controller/module-show-controller.js
===================================================================
--- package/out/command-line/controller/module-show-controller.js
+++ package/out/command-line/controller/module-show-controller.js
@@ -0,0 +1,40 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ModuleShowController = void 0;
+const cli_shared_1 = require("@forge/cli-shared");
+const module_add_controller_1 = require("./module-add-controller");
+class ModuleShowController {
+ moduleView;
+ moduleService;
+ constructor(moduleView, moduleService) {
+ this.moduleView = moduleView;
+ this.moduleService = moduleService;
+ }
+ async run(options) {
+ try {
+ await this.runModuleShow(options);
+ }
+ finally {
+ this.moduleService.cleanup();
+ }
+ }
+ async runModuleShow(options) {
+ if (!options.moduleType) {
+ throw new Error(cli_shared_1.Text.module.show.errorModuleTypeRequired);
+ }
+ const selectedModule = await this.resolveModule(options.moduleType);
+ this.moduleView.renderModuleDetails(await this.moduleService.getModuleShowMeta(selectedModule));
+ }
+ async resolveModule(moduleType) {
+ const moduleMaps = await Promise.all(module_add_controller_1.MODULE_PRODUCTS.map((product) => this.moduleService.getAvailableModules(product)));
+ const modules = moduleMaps.flatMap((moduleMap) => [...moduleMap.values()]);
+ const normalizedModuleType = moduleType.toLowerCase();
+ const selectedModule = modules.find((module) => module.moduleKey.toLowerCase() === normalizedModuleType);
+ if (!selectedModule) {
+ throw new Error(cli_shared_1.Text.module.show.errorFailedToResolveModule(moduleType));
+ }
+ return selectedModule;
+ }
+}
+exports.ModuleShowController = ModuleShowController;
+//# sourceMappingURL=module-show-controller.js.map
\ No newline at end of file