Skip to content

Commit

Permalink
Sort orgs by name
Browse files Browse the repository at this point in the history
  • Loading branch information
remileblond67076 committed Jan 22, 2025
1 parent 8bfb096 commit 9f989c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gristtools/gristtools.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,12 @@ func DisplayDoc(docId string) {
// Displays the list of accessible organizations
func DisplayOrgs() {

// Getting the list of organizations
lstOrgs := gristapi.GetOrgs()
// Sorting the list of organizations by name (lowercase)
sort.Slice(lstOrgs, func(i, j int) bool {
return strings.ToLower(lstOrgs[i].Name) < strings.ToLower(lstOrgs[j].Name)
})
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Id", "Name"})
for _, org := range lstOrgs {
Expand Down

0 comments on commit 9f989c2

Please sign in to comment.