huh
huh copied to clipboard
huh.Select filtering doesn't show all matching options
Describe the bug
I'm using huh.Select to present a list of options to the user. However when I filter down using / it doesn't show all of the available options. If I'm specific enough sometimes the option I'm looking for suddenly appears.
When I type sonnet initially, only anthropic/claude-3-sonnet shows. If I add - then delete it suddenly all the sonnet models show.
Setup
Please complete the following information along with version numbers, if applicable.
- OS: macOS
- Shell: fish
- Terminal Emulator: ghostty
- Terminal Multiplexer: N/A
To Reproduce
See below.
Source Code
Pass a list of options into this func:
func showForm(ctx context.Context, models []string) (string, string, error) {
var (
question string
model = defaultModel
)
form := huh.NewForm(
huh.NewGroup(
huh.NewInput().
Title("Enter a task").
Value(&question),
huh.NewSelect[string]().
Title("Select a model").
Value(&model).
Height(10).
Options(huh.NewOptions(models...)...),
),
)
if err := form.RunWithContext(ctx); err != nil {
log.Fatalf("Failed to run input: %v", err)
}
return question, model, nil
}
Expected behavior
Filtering shows all matching results.
Screenshots
See above.
Additional context
github.com/charmbracelet/huh v0.7.0