Show HN: RatatuiRuby wraps Rust Ratatui as a RubyGem – TUIs with the joy of Ruby
152 points
1 month ago
| 16 comments
| ratatui-ruby.dev
| HN
cswilliams
1 month ago
[-]
Excited to try it out as well. I often need to build simple CLI based apps in ruby so often would reach for TTY Toolkit: https://ttytoolkit.org/

However, I feel like it's in maintenance mode at this point, so glad to see some new options available.

reply
3eb7988a1663
1 month ago
[-]
Shouldn't some software be allowed to be done? Maintenance mode on a TUI library seems a reasonable place to be.
reply
cswilliams
1 month ago
[-]
Sure. I was probably trying to be too polite and didn't want to use the word "abandoned", but that's probably a better term for the library at this point. There's a good amount of open issues and PRs in many of the component gems that haven't been addressed in years and requests to help maintain it have gone unanswered[0].

[0] https://github.com/piotrmurach/tty-prompt/issues/210

reply
3eb7988a1663
1 month ago
[-]
Ah yes, quite a different kettle of fish.
reply
an0malous
1 month ago
[-]
sure it’s a good TUI library, but is it agentic?
reply
iddan
1 month ago
[-]
Landing page is great: informative, visual example, clear code example. Love it
reply
Kerrick
1 month ago
[-]
Thank you! I wrote the code snippets and picked the color palette, but the web design came by way of https://news.ycombinator.com/item?id=46587284

And my wife, wonderful as always, helped critique the writing! My RadioMenu class's comments (in the "See More: Inline menu example" expando-section) were far worse before she helped.

reply
xfalcox
1 month ago
[-]
I just made a new installer for Discourse on CharmRuby, now I gotta check this out and see if porting is feasible. Hopefully this reduces the app size, that is quite large with CharmRuby
reply
pjmlp
1 month ago
[-]
Living the 80s, I guess the current nostalgia wave across tapes, portable CD players, Vynil and co, also applies to computer interfaces.
reply
Kerrick
1 month ago
[-]
That's gotta be part of it. But I think another important part is how TUIs have important restrictions that lead to surprisingly delightful applications despite their downsides:

- You don't have control over font size and your color palette can be limited (and chosen by the user in their Terminal settings), so it's hard to go too off-the-rails in aesthetic design

- You work on a strict character grid, so it's hard to get things like padding, margin, and leading wrong.

- You can't assume the use of a mouse, so everything has to work on keyboard shortcuts. This usually leads to extremely power-user-friendly tools. Plus, keyboard-driven, power-user-friendly UIs are hot right now, even on the web (Linear, Fernand, etc.).

reply
jarek83
1 month ago
[-]
It looks great overall, but the example browser is something really special! Never seen such detailed walkthroughs before.
reply
Kerrick
1 month ago
[-]
Thank you very much. I am not proud of the AI slop code [0] it took to get RDoc to generate the HTML for those pages, but I am proud of the result!

[0]: https://git.sr.ht/~kerrick/ratatui_ruby/tree/783a08eabe2307f...

[1]: https://www.ratatui-ruby.dev/docs/v1.0/examples/app_color_pi...

reply
pythonaut_16
1 month ago
[-]
Looks exciting!

Does it have proper support for opening an external editor (via $EDITOR like nano, vim, etc?)? I ran into issues with that in Ink and had to switch over to Bubbletea, but I'd love to use Ruby instead of Go

reply
Kerrick
1 month ago
[-]
Yes! While there's nothing built-in for that, you have full control over when you enter or exit raw mode, so your TUI can support opening an external editor. The TL;DR is you need to call `RatatuiRuby.restore_terminal` before handing off to $EDITOR, and you can call `RatatuiRuby.init_terminal` again to re-enter your TUI.

Here's an example: https://www.ratatui-ruby.dev/docs/trunk/examples/app_externa...

Also, if you enjoy Ink and Bubbletea, you probably enjoy MVU. If that's the case, check out the upcoming Rooibos framework I'm building on RatatuiRuby: https://rooibos.run. (Caveat: it doesn't yet have a way to restore/init the terminal, but I clearly need to make that happen.)

reply
riffraff
1 month ago
[-]
I know nothing about this, but bubbletea-ruby was in the news recently

https://github.com/marcoroth/bubbletea-ruby

reply
kasane_teto
1 month ago
[-]
I’m gonna look into this. I was originally going to use the curses gem for my ruby tui apps but dealing with straight curses gets annoying quick. Thanks!
reply
aaronbrethorst
1 month ago
[-]
super cool, great work Kerrick!
reply
Kerrick
1 month ago
[-]
Thank you! My first Show HN in 2012 [0] was an inline TUI (of sorts) written in Ruby [1], so this is a great day.

[0]: https://news.ycombinator.com/item?id=4017933

[1]: https://kerrick.github.io/google/

reply
rubyfan
1 month ago
[-]
Looks really interesting, I’m excited to explore this.
reply
desireco42
1 month ago
[-]
I can't like this enough, Ruby is perfect language for TUI apps and emergence of TUI apps is really welcome change.
reply
anon5739483
1 month ago
[-]
Thank you for enabling my Ruby addiction. This looks amazing. Great work!
reply
Kerrick
1 month ago
[-]
Every person I can enable to write Ruby instead of Go is a win in my book. :-)
reply
rufugee
1 month ago
[-]
Looking forward to experimenting with it. Looks awesome!
reply
somebehemoth
1 month ago
[-]
How significant are AI contributions to this project?
reply
Kerrick
1 month ago
[-]
Very significant. Nearly every commit has involved the use of one or more LLMs, as evidenced by the commit trailers. I would not have started this project without it, because I do not know Rust. Even the overall direction and architecture has involved roleplay-based "rubber ducking" with LLMs [0].

I've carefully stewarded & heavily edited the Ruby code in lib/ and test/, and the documentation (RDoc and Markdown). The Rust code has been left largely to the AI, with its quality kept presumably-okay by Clippy and extensive automated tests on the Ruby side.

As for the non-library stuff ("internal" to the project), you can tell by browsing the tasks/ folder where I left the AI to its own devices [1], and where I heavily edited the Ruby code [2].

[0]: https://man.sr.ht/~kerrick/ratatui_ruby/history/ecosystem-dr...

[1]: https://git.sr.ht/~kerrick/ratatui_ruby/tree/783a08eabe2307f...

[2]: https://git.sr.ht/~kerrick/ratatui_ruby/tree/783a08eabe2307f...

reply
atmosx
1 month ago
[-]
Great job :-)
reply
knowitnone3
1 month ago
[-]
This is awesome, will definitely take this for a spin!
reply
Kerrick
1 month ago
[-]
Thank you! Please let me know how you find it. I want to make sure the DX is as good as possible.
reply
rbitar
1 month ago
[-]
Fantastic, this looks excellent and excited to try it
reply
ianks
1 month ago
[-]
Love it
reply