Skip to content

Commit

Permalink
Multi select list is now ordered.
Browse files Browse the repository at this point in the history
This behaviour is not configurable.
  • Loading branch information
blkt committed May 11, 2024
1 parent 052a79d commit 177bc99
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/util/cli/multi_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
package cli

import (
"cmp"
"fmt"
"io"
"slices"
"strings"

"github.com/charmbracelet/bubbles/key"
Expand All @@ -37,6 +39,10 @@ func MultiSelect(choices []string) ([]string, error) {
items = append(items, item{title: c})
}

slices.SortFunc(items, func(a, b list.Item) int {
return cmp.Compare(a.(item).title, b.(item).title)
})

l := list.New(items, itemDelegate{}, 0, 0)
l.Title = "Select repos to register"
l.Styles.Title = Header
Expand Down

0 comments on commit 177bc99

Please sign in to comment.