Skip to content

Commit

Permalink
Directly select the only one project (#51)
Browse files Browse the repository at this point in the history
If there is only one project, directly use the one in interactive mode.
  • Loading branch information
xuanyu66 committed Dec 9, 2022
1 parent 6166a82 commit d3a1fc6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/service/cloud/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func GetSelectedProject(pageSize int64, client TiDBCloudClient) (*Project, error
if err != nil {
return nil, err
}

// If there is only one project, return it directly.
if len(projectItems) == 1 {
return &Project{
projectItems[0].ID,
projectItems[0].Name,
}, nil
}

set := hashset.New()
for _, item := range projectItems {
set.Add(&Project{
Expand Down

0 comments on commit d3a1fc6

Please sign in to comment.