allow initial query and select if there is exactly one match
This commit is contained in:
+15
-5
@@ -91,11 +91,8 @@ func main() {
|
|||||||
seshNames = append(seshNames, seshName)
|
seshNames = append(seshNames, seshName)
|
||||||
}
|
}
|
||||||
slices.Sort(seshNames)
|
slices.Sort(seshNames)
|
||||||
i, err := fuzzyfinder.Find(
|
|
||||||
seshNames,
|
options := []fuzzyfinder.Option{
|
||||||
func(i int) string {
|
|
||||||
return seshNames[i]
|
|
||||||
},
|
|
||||||
fuzzyfinder.WithPreviewWindow(
|
fuzzyfinder.WithPreviewWindow(
|
||||||
func(i, width, height int) string {
|
func(i, width, height int) string {
|
||||||
width = width/2 - 4
|
width = width/2 - 4
|
||||||
@@ -125,6 +122,19 @@ func main() {
|
|||||||
return builder.String()
|
return builder.String()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
fuzzyfinder.WithSelectOne(),
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
options = append(options, fuzzyfinder.WithQuery(os.Args[1]))
|
||||||
|
}
|
||||||
|
|
||||||
|
i, err := fuzzyfinder.Find(
|
||||||
|
seshNames,
|
||||||
|
func(i int) string {
|
||||||
|
return seshNames[i]
|
||||||
|
},
|
||||||
|
options...,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user