From 56e4c3738365e4251e72cb8a48a31bc79f31c69c Mon Sep 17 00:00:00 2001 From: "john@plural.sh" Date: Thu, 12 Feb 2026 15:44:14 -0500 Subject: [PATCH] fix choseCluster() from silently returning on hostname match --- cmd/command/up/up.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cmd/command/up/up.go b/cmd/command/up/up.go index a333dd11..61920083 100644 --- a/cmd/command/up/up.go +++ b/cmd/command/up/up.go @@ -196,20 +196,31 @@ func (p *Plural) choseCluster() (name, url string, err error) { clusterNames := []string{} clusterMap := map[string]string{} + defaultSelection := "" for _, cluster := range instances { if prior.Url != "" && strings.EqualFold(common.GetHostnameFromURL(prior.Url), common.GetHostnameFromURL(cluster.URL)) { - name = cluster.Name - url = cluster.URL - return + defaultSelection = cluster.Name } clusterNames = append(clusterNames, cluster.Name) clusterMap[cluster.Name] = cluster.URL } + if len(clusterNames) == 0 { + err = fmt.Errorf("no cloud instances are available for this account") + return + } + + if len(clusterNames) == 1 { + name = clusterNames[0] + url = clusterMap[name] + return + } + prompt := &survey.Select{ Message: "Select one of the following clusters:", Options: clusterNames, + Default: defaultSelection, } if err = survey.AskOne(prompt, &name, survey.WithValidator(survey.Required)); err != nil { return