-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default searcher implemetation #212
Comments
The idea is not make the So the final code would look something like this: func main() {
items := []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
prompt := promptui.Select{
StartInSearchMode: true,
Label: "Select Day",
Items: items,
Searcher: promptui.SimpleRegexSearcher(items),
}
_, result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
fmt.Printf("You choose %q\n", result)
} |
In case of speed and also error checking I would not use regex for this, just a |
Fair point. Yeah we could change it to use that instead. |
Oh, actually... I think I did try this and it turns out you can't make it so it's case insensitive. That was the reason I used |
Ping @jbowes 🔔 . Hi, James. Do you still support this repo or is it already considered stable (no further changes)? |
Hi, firstly thanks for the code. It's great.
I've had a bit of problem using the search feature but after digging a little bit, I've found my way.
Have said that, I reckon it would be awesome if there was some kind of default simple implementation of the searcher someone could use that could fit a lot of differet usecases.
This implementation doesn't add any dependencies since it only uses the std library.
Here's the idea:
Let me know if you think this is a good idea so I can make a PR :)
The text was updated successfully, but these errors were encountered: