Skip to content

Commit

Permalink
Merge pull request #104 from DopplerHQ/tom_project_slug
Browse files Browse the repository at this point in the history
 Don't print project slug if identical to project name
  • Loading branch information
Piccirello authored Jun 30, 2020
2 parents 96b429a + cfb838f commit 5c51d71
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/cmd/enclave_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ var setupCmd = &cobra.Command{
utils.HandleError(apiError.Unwrap(), apiError.Message)
}
if len(configs) == 0 {
utils.HandleError(errors.New("your project does not have any configs"))
utils.Log("You project does not have any configs")
break
}

selectedConfig = selectConfig(configs, selectedConfiguredProject, scopedConfig.EnclaveConfig.Value, promptUser)
Expand Down Expand Up @@ -129,7 +130,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 +168,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 5c51d71

Please sign in to comment.