Skip to content

Commit

Permalink
Don't print project slug if identical to project name
Browse files Browse the repository at this point in the history
  • Loading branch information
Piccirello committed Jun 30, 2020
1 parent 96b429a commit 014e04e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/enclave_setup.go
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 014e04e

Please sign in to comment.