huh
huh copied to clipboard
feat: set filtering state of select
This PR adresse the following issue #173
It allows allows use the select where the filter mode is activated when Run starts.
Thanks for telling me to also update the focus @maaslalani !
I have the following results with this code (readme example adapted a little).
package main
import (
"fmt"
"github.com/charmbracelet/huh"
)
func main() {
var country string
s := huh.NewSelect[string]().
Title("Pick a country.").
Filtering(true).
Options(
huh.NewOption("United States", "US"),
huh.NewOption("Germany", "DE"),
huh.NewOption("Brazil", "BR"),
huh.NewOption("Canada", "CA"),
).
Value(&country)
huh.NewForm(huh.NewGroup(s)).Run()
fmt.Println("You chose ", country)
}