fix: if sort, sort options alphabetically first

This commit is contained in:
Carlos Alexandro Becker 2024-12-03 15:13:50 -03:00
commit 86e8fc0a5b
No known key found for this signature in database

View file

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"slices"
"strings"
"github.com/charmbracelet/bubbles/textinput"
@ -54,6 +55,10 @@ func (o Options) Run() error {
options = append(options, tea.WithAltScreen())
}
if o.Sort {
slices.SortStableFunc(o.Options, strings.Compare)
}
var matches []fuzzy.Match
if o.Value != "" {
i.SetValue(o.Value)