Learning to build TUIs (and Regular Expressions)
For the past couple of days, I’ve been busy working on a CLI Tool where I can brush up on Regex whenever I need to. I have gone over the syntax of Regex many times by now, and for some reason when I need to remember how things work, I cannot seem to conjure up faily straightforward expressions for grepping something I’m interested. I have to call upon good ol’ ChatGPT to help me out in such scenarios. And sometimes when I have too much free time, this mild frustration of not being able to write exact regex pushes me to go through regimented “workbooks” of Regex excercises from various sources. So I thought why not build something for myself I can turn to for learning/brushing up on Regex whenever I felt like, and probably maybe gamify the process.
I came across bubbletea, which is a TUI (Terminal UI) framework for building interactive CLI tools. Learning to use this tool was fun. It’s based on the Elm-Architecture which sounds complicated, but has the same “vibe” as building a React application (without the complicated parts of React). Bubbletea is beautifully crafted, much of the complicated terminal “stuff” is abstracted away, and the interface provided by them is almost dead simple.
This is what I was able build with the help of bubbletea and a few lines of Go code:

I now have a tool I can turn to brush up on my Regex skills for whatever reason. It was fun putting this together and I’m happy with the way this CLI tool turned out.