@forge/cli

14.1.0-next.19-experimental-fd0ebbc14.1.0-next.32
out/command-line/view/global-install-view.js
~out/command-line/view/global-install-view.jsModified
+17−14
Index: package/out/command-line/view/global-install-view.js
===================================================================
--- package/out/command-line/view/global-install-view.js
+++ package/out/command-line/view/global-install-view.js
@@ -1,9 +1,7 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.GlobalInstallView = void 0;
-const tslib_1 = require("tslib");
-const chalk_1 = tslib_1.__importDefault(require("chalk"));
 const semver_1 = require("semver");
 const cli_shared_1 = require("@forge/cli-shared");
 class GlobalInstallView {
     ui;
@@ -17,25 +15,36 @@
             return { org: target.orgName };
         return { unit: target.unitName ?? target.unitId, org: target.orgName };
     }
     async selectByName(prompt, items) {
-        const byName = new Map(items.map((item) => [item.name, item]));
-        const name = await this.ui.promptForFilterableList(prompt, items.map((item) => item.name));
-        return byName.get(name) ?? items[0];
+        const nameCounts = new Map();
+        for (const { name } of items) {
+            nameCounts.set(name, (nameCounts.get(name) ?? 0) + 1);
+        }
+        const byLabel = new Map();
+        const labels = items.map((item) => {
+            const label = (nameCounts.get(item.name) ?? 0) > 1 ? `${item.name} (${item.id})` : item.name;
+            byLabel.set(label, item);
+            return label;
+        });
+        const chosen = await this.ui.promptForFilterableList(prompt, labels);
+        return byLabel.get(chosen) ?? items[0];
     }
     fetchWithSpinner(fetch) {
         return this.ui.displaySpinner(fetch);
     }
     selectOrganization(orgs) {
         return this.selectByName(cli_shared_1.Text.install.global.promptOrganization, orgs);
     }
     showSelectUnitOverview() {
+        this.ui.emptyLine();
         this.ui.info(cli_shared_1.Text.install.global.selectUnitOverview);
     }
     selectUnit(units) {
         return this.selectByName(cli_shared_1.Text.install.global.promptUnit, units);
     }
     showInstallConfirmation(target) {
+        this.ui.emptyLine();
         this.ui.info(cli_shared_1.Text.install.global.installConfirmation(this.toTextTarget(target)));
     }
     confirmContinueInstall() {
         return this.ui.confirm(cli_shared_1.Text.install.global.promptContinueInstall);
@@ -77,28 +86,22 @@
     }
     async selectConnection(options) {
         this.ui.emptyLine();
         const byProduct = new Map(options.map((option) => [option.product, option]));
-        const chosen = await this.ui.promptForList(cli_shared_1.Text.install.global.promptConnection, options.map((option) => option.product), {
-            format: (product) => {
-                const option = byProduct.get(product);
-                return option?.linked ? chalk_1.default.grey(`${product}${cli_shared_1.Text.install.global.linkedSuffix}`) : product;
-            }
-        });
+        const chosen = await this.ui.promptForList(cli_shared_1.Text.install.global.promptConnection, options.map((option) => option.product));
         return byProduct.get(chosen);
     }
-    showAlreadyLinked(product) {
-        this.ui.info(cli_shared_1.Text.install.global.alreadyLinked(product));
-    }
     async promptForConnectionTarget(kind) {
+        this.ui.emptyLine();
         if (kind === 'workspace') {
             this.ui.info(cli_shared_1.Text.install.global.enterWorkspaceOverview);
             return this.ui.promptForText(cli_shared_1.Text.install.global.promptWorkspace);
         }
         this.ui.info(cli_shared_1.Text.install.global.enterSiteOverview);
         return this.ui.promptForText(cli_shared_1.Text.install.global.promptSiteUrl);
     }
     showConnectConfirmation(product, kind) {
+        this.ui.emptyLine();
         this.ui.info(kind === 'workspace'
             ? cli_shared_1.Text.install.global.connectConfirmationWorkspace(product)
             : cli_shared_1.Text.install.global.connectConfirmationSite(product));
     }