-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add selection prompt #33
Conversation
Thanks for the PR! At first glance this looks pretty good. Could you add an example application in a subdirectory (perhaps called |
My bad, I forgot to add the asciinema recordings I made for #25.
Now, when writing this down, I think I should definitely do this. |
Another consideration: Should I change the |
Yes, that makes sense; so maybe something like m := NewModel(WithChoices("a", b")) This would also allow other options such as: m := NewModel(
WithChoices(c),
WithKeybindings(k),
) |
I would have used choices := []Article{
{ID: "123", Name: "Article A"},
{ID: "234", Name: "Article B"},
{ID: "345", Name: "Article C"},
{ID: "456", Name: "Article D"},
{ID: "567", Name: "Article E"},
}
prompt := selection.NewModel(selection.Choices(choices))
prompt.Label = "Choose an article!"
prompt.PageSize = 3
prompt.Template = customTemplate
prompt.Filter = func(filter string, choice *selection.Choice) bool {
article, _ := choice.Value.(Article)
return strings.Contains(article.ID, filter)
} I think that your second option would be too much given that the user can just set the optional configuration directly on the model. This also feels more in line with the other models. The choices would be taken as an argument only because they are mandatory. |
Is there anything I can do or change to move forward with this? |
@erikgeiser Sorry for the delay on this one; we've been really busy over here. It may be a little while until we can give this a proper review, but we will get to it. |
Do you still plan to do something about this PR? |
Hey Erik. We looked at this again, and while the component is a bit too specific for this repository, we really like it. Would you be open to creating a repository for it so we can link to it from the README as an additional resource? |
Okay, I can work with that decision. I'll see if I can find the time to make a small prompt library around the selection prompt. |
Sounds good. Please do let us know when it's ready. I enjoyed reading your code, by the way. They notion of the key map you came up with was particularly impressive. |
Thank you. Ultimately, I think it is a good decision not to merge this into I took this opportunity to create a prompt library on top of |
It's great to see another release of promptkit and nice that the library works both standalone and as something that can be integrated into a larger Bubble Tea project. I've added promptkit to the README. |
Thank you, currently the library is fairly limited due to charmbracelet/bubbletea#24 as you can only run one prompt before key strokes are lost, but I'll see what I can due about that issue. |
Ah, good point. It's an interesting issue and a tricky one to solve from what I understand. There are some notes in the thread around it: you're more than welcome to take a look. |
Gonna close this one, as we resolved the situation. Thank you for all your amazing work, @erikgeiser! |
This PR adds a selection prompt with the following features:
Examples: