From 044c55f9b0365daf4812e09593ea19e55934a5e8 Mon Sep 17 00:00:00 2001 From: Carrano Date: Tue, 21 Jul 2026 15:44:36 +0200 Subject: [PATCH 1/2] fix: sort projects, environments, and services alphabetically in context set The interactive pickers in 'qovery context set' listed projects, environments, and services in API response order instead of alphabetically, making them hard to scan for orgs with many entries. --- utils/qovery.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/qovery.go b/utils/qovery.go index a10e2e83..dbe74b44 100644 --- a/utils/qovery.go +++ b/utils/qovery.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "os" + "sort" "strconv" "strings" "time" @@ -251,6 +252,7 @@ func SelectProject(organizationID Id) (*Project, error) { projectsNames = append(projectsNames, proj.Name) projects[proj.Name] = proj.Id } + sort.Strings(projectsNames) if len(projectsNames) < 1 { return nil, errors.New("no projects found") @@ -347,6 +349,7 @@ func SelectEnvironment(projectID Id) (*Environment, error) { environmentsNames = append(environmentsNames, env.Name) environments[env.Name] = env } + sort.Strings(environmentsNames) if len(environmentsNames) < 1 { return nil, errors.New("no environments found") @@ -620,6 +623,8 @@ func SelectService(environment Id) (*Service, error) { Type: TerraformType, } } + sort.Strings(servicesNames) + if len(servicesNames) < 1 { return nil, errors.New("no services found") } From 0902d3d60519cc51c86ad7618089e134d61e287b Mon Sep 17 00:00:00 2001 From: Carrano Date: Tue, 21 Jul 2026 15:49:23 +0200 Subject: [PATCH 2/2] fix: sort context set lists case-insensitively sort.Strings does a byte-wise ASCII comparison, so mixed-case names (e.g. "Production", "staging", "Development") sorted as all-uppercase- first rather than true alphabetical order. Switch to a case-insensitive sort and apply it consistently to organizations, projects, environments, and services. --- utils/qovery.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/qovery.go b/utils/qovery.go index dbe74b44..52585e8c 100644 --- a/utils/qovery.go +++ b/utils/qovery.go @@ -27,6 +27,12 @@ func init() { }) } +func sortNamesCaseInsensitive(names []string) { + sort.Slice(names, func(i, j int) bool { + return strings.ToLower(names[i]) < strings.ToLower(names[j]) + }) +} + type Organization struct { ID Id Name Name @@ -156,6 +162,7 @@ func SelectOrganization() (*Organization, error) { organizationNames = append(organizationNames, org.Name) orgs[org.Name] = org.Id } + sortNamesCaseInsensitive(organizationNames) if len(organizationNames) < 1 { return nil, errors.New("no organizations found") @@ -252,7 +259,7 @@ func SelectProject(organizationID Id) (*Project, error) { projectsNames = append(projectsNames, proj.Name) projects[proj.Name] = proj.Id } - sort.Strings(projectsNames) + sortNamesCaseInsensitive(projectsNames) if len(projectsNames) < 1 { return nil, errors.New("no projects found") @@ -349,7 +356,7 @@ func SelectEnvironment(projectID Id) (*Environment, error) { environmentsNames = append(environmentsNames, env.Name) environments[env.Name] = env } - sort.Strings(environmentsNames) + sortNamesCaseInsensitive(environmentsNames) if len(environmentsNames) < 1 { return nil, errors.New("no environments found") @@ -623,7 +630,7 @@ func SelectService(environment Id) (*Service, error) { Type: TerraformType, } } - sort.Strings(servicesNames) + sortNamesCaseInsensitive(servicesNames) if len(servicesNames) < 1 { return nil, errors.New("no services found")