File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package choose
3
3
import (
4
4
"errors"
5
5
"fmt"
6
- "maps"
7
6
"os"
8
7
"slices"
9
8
"sort"
@@ -38,6 +37,8 @@ func (o Options) Run() error {
38
37
39
38
// normalize options into a map
40
39
options := map [string ]string {}
40
+ // keep the labels in the user-provided order
41
+ var labels []string
41
42
for _ , opt := range o .Options {
42
43
if o .LabelDelimiter == "" {
43
44
options [opt ] = opt
@@ -47,10 +48,11 @@ func (o Options) Run() error {
47
48
if ! ok {
48
49
return fmt .Errorf ("invalid option format: %q" , opt )
49
50
}
51
+ labels = append (labels , label )
50
52
options [label ] = value
51
53
}
52
54
if o .LabelDelimiter != "" {
53
- o .Options = slices . Collect ( maps . Keys ( options ))
55
+ o .Options = labels
54
56
}
55
57
56
58
if o .SelectIfOne && len (o .Options ) == 1 {
You can’t perform that action at this time.
0 commit comments