fix: KeepOrder -> Ordered

This commit is contained in:
Maas Lalani 2023-01-12 13:01:09 -05:00
parent 1f36e76ac9
commit ebc8c1fd6b
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
2 changed files with 2 additions and 2 deletions

View file

@ -123,7 +123,7 @@ func (o Options) Run() error {
return exit.ErrAborted return exit.ErrAborted
} }
if o.KeepOrder && o.Limit > 1 { if o.Ordered && o.Limit > 1 {
sort.Slice(m.items, func(i, j int) bool { sort.Slice(m.items, func(i, j int) bool {
return m.items[i].order < m.items[j].order return m.items[i].order < m.items[j].order
}) })

View file

@ -8,7 +8,7 @@ type Options struct {
Limit int `help:"Maximum number of options to pick" default:"1" group:"Selection"` Limit int `help:"Maximum number of options to pick" default:"1" group:"Selection"`
NoLimit bool `help:"Pick unlimited number of options (ignores limit)" group:"Selection"` NoLimit bool `help:"Pick unlimited number of options (ignores limit)" group:"Selection"`
KeepOrder bool `help:"Keep the order of the selected options" env:"GUM_CHOOSE_KEEP_ORDER"` Ordered bool `help:"Maintain the order of the selected options" env:"GUM_CHOOSE_ORDERED"`
Height int `help:"Height of the list" default:"10" env:"GUM_CHOOSE_HEIGHT"` Height int `help:"Height of the list" default:"10" env:"GUM_CHOOSE_HEIGHT"`
Cursor string `help:"Prefix to show on item that corresponds to the cursor position" default:"> " env:"GUM_CHOOSE_CURSOR"` Cursor string `help:"Prefix to show on item that corresponds to the cursor position" default:"> " env:"GUM_CHOOSE_CURSOR"`
CursorPrefix string `help:"Prefix to show on the cursor item (hidden if limit is 1)" default:"○ " env:"GUM_CHOOSE_CURSOR_PREFIX"` CursorPrefix string `help:"Prefix to show on the cursor item (hidden if limit is 1)" default:"○ " env:"GUM_CHOOSE_CURSOR_PREFIX"`