From 014e04e114479cd2450521b6af4bff3f66c3d3be Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Tue, 30 Jun 2020 00:08:34 -0700 Subject: [PATCH] Don't print project slug if identical to project name --- pkg/cmd/enclave_setup.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/enclave_setup.go b/pkg/cmd/enclave_setup.go index 2d308297..f7ebb64b 100644 --- a/pkg/cmd/enclave_setup.go +++ b/pkg/cmd/enclave_setup.go @@ -129,7 +129,10 @@ func selectProject(projects []models.ProjectInfo, prevConfiguredProject string, var options []string var defaultOption string for _, val := range projects { - option := val.Name + " (" + val.ID + ")" + option := val.Name + if val.Name != val.ID { + option = fmt.Sprintf("%s (%s)", option, val.ID) + } options = append(options, option) if val.ID == prevConfiguredProject { @@ -164,7 +167,7 @@ func selectProject(projects []models.ProjectInfo, prevConfiguredProject string, } for _, val := range projects { - if strings.HasSuffix(selectedProject, "("+val.ID+")") { + if selectedProject == val.ID || strings.HasSuffix(selectedProject, "("+val.ID+")") { return val.ID } }