charmbracelet / bubbletea

A powerful little TUI framework 🏗

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implementation of a search with a list of output results

koddr opened this issue · comments

Hi,

I'm trying to make a CLI utility with Bubbletea (and LipGloss + Bubbles) for some kind of full-text search on data from my database, but I can't implement the following principle (with the level of understanding of your library that I have now):

  1. When I start the program, only the input line for the query text is shown;
  2. After entering the query text (and pressing Enter), the search is done (under the hood, in goroutine, for example);
  3. The results are shown as a list of items (as in the example here);
  4. If you click Enter (or Space) on the selected item, it opens the browser and goes to the link (which was in the metadata of this item from my database);
  5. To return to the search bar (and thus close the list), you need to press, for example, Esc and you're back in the original screen (where the search bar);

If this this logic can't be implemented that way, but maybe you can somehow extend the standard filter of the list widget?

For example, give some API to convert filter into input string, text from which (after pressing Enter) can be passed to external function (like goroutine) and show results in returned list (like it happens with filtering).

I've been studying Bubbletea for about a week now through the source code and the examples in all of your (and not only) repositories, but I can't figure it out and put it all together... Can you please give me a hint? Please... 😢

Also, if someone can help with a minimal working example code for the algorithm I described above, I would be really happy!

Hi! I think we can sort this one out fastest via chat — want to hop into our Slack and go from there?