[HN Gopher] Charm Ruby - Glamorous Terminal Libraries for Ruby
___________________________________________________________________
Charm Ruby - Glamorous Terminal Libraries for Ruby
Author : todsacerdoti
Score : 124 points
Date : 2025-12-30 07:36 UTC (15 hours ago)
(HTM) web link (charm-ruby.dev)
(TXT) w3m dump (charm-ruby.dev)
| thomascountz wrote:
| I'm excited to take a look at this! Using Charmbracelet's
| libraries for TUIs is part of why I learned Go. Ruby's TUI story
| has generally been underdeveloped by comparison.
|
| Also, Marco (library creator) was just awarded the Rails Luminary
| award![1]
|
| [1]: https://rubyonrails.org/2025/12/17/marco-roth-2025-rails-
| lum...
| marcoroth wrote:
| I always loved Charm's aesthetics and it really opened my eyes
| with what can be done with TUIs. But I never felt like I wanted
| to learn Go just to be able to use these libraries. Ruby is
| magical in it's own way, so it just felt right to bring these
| libraries over to Ruby!
| throw-12-16 wrote:
| Interesting, huge fan of charm and ruby.
|
| Will definitely keep this in mind.
| marcoroth wrote:
| Definitely just the beginning. Any ideas or feedback is very
| much appreciated as we build out these libraries!
| Kerrick wrote:
| This is really cool! It looks like Marco and I had the same idea
| around the same time, but we picked different TUI libraries to
| wrap. :-D
|
| See also: https://git.sr.ht/~kerrick/ratatui_ruby
| riddley wrote:
| How funny. I just spent the weekend AI slopping an FFI wrapper
| around notcurses because I couldn't find anything else. This
| looks amazing!
|
| Since you asked for ideas in a different comment, here's
| something I put into my notcurses wrapper: grid and flex "css"
| layouts. Meaning the ability to say whatever.fixed(cols,...) and
| whatever.flex(:fr1) or whatever.grid(:fr1) and the ability to do
| a "grid-template-areas" style ascci art ala
| https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Grid...
| drakythe wrote:
| > ... couldn't find anything else
|
| Anything else meaning...? Ruby specific TUI library? I've been
| toying around with a lot of TUI's recently, landed on Textual
| (Python) for my most recent experiemnt, but Charm has been on
| my list to try out when I get a chance. There are also a number
| of other libs that will let you build quite robust applications
| in a number of languages (Rust, Python, Go, PHP, and those are
| just the one's I am aware of).
| riddley wrote:
| Indeed, looking for Ruby-specific stuff. There are a couple
| of ncurses wrappers that are not the friendliest things and
| at the other end of the spectrum there's the "TTY" code
| which, while nice isn't powerful enough to do what I was
| wanting to do.
| andreynering wrote:
| Charm team member here. Ruby and Go are my favorite languages.
| Excited to see this come to life!
| eterps wrote:
| What are popular charm/bubbletea based TUIs? I use TUIs often,
| but for some reason none of them are based on charm/bubbletea?
| Might be coincidence though.
|
| While I appreciate Charm's aesthetics, I worry it leans too
| heavily on GUI paradigms, like popovers and buttons, rather than
| prioritizing the optimal keyboard efficiency used in traditional
| text-based interfaces.
| cmiles74 wrote:
| I like the terminal-based LLM tool, Crush. I find it handy in
| that I can pull it into any IDE and it works the same.
|
| - https://github.com/charmbracelet/crush
| Alifatisk wrote:
| This is like a dream come true, fantastic! Regarding the spinner
| component, can I create multiple of those in the terminal and
| have them run concurrently? That is one of the features that lots
| of gems have been lacking in Ruby, at least from what I've found.
| Tty-progressbar is the only gem I've found that can do this.
| marcoroth wrote:
| Yeah definitely! When you use them in the bubbletea `view` you
| can render multiple bubbles components at the same time.
| tester457 wrote:
| Charm's tui library is fantastic. This combined with ruby's ease
| of use will make writing cli apps more fun!
| solatic wrote:
| Bookmarked, I think this is a really good idea and could lead to
| some really small, elegant TUI code.
|
| But as a first release, I'm wondering if it maybe misses what
| Ruby really enables. The Hello World example has both init and
| initialize methods? message.to_s == "q"? @style.render?
|
| I remember reading Eloquent Ruby and having my mind _completely
| blown_ with the clarity and expressiveness that Ruby 's
| metaprogramming enabled. It remains, in my opinion, one of the
| best programming books of all time for just how mind expanding it
| was and how it really made the case for Ruby and why there is no
| other language like Ruby.
|
| I highly recommend that the authors go pick up a copy and _then_
| think about how it would influence their API design, I think
| there 's a much more... eloquent approach feasible here, and it
| would be a pretty incredible way to build small/simple TUI apps.
| weaksauce wrote:
| the author of these libraries is a very experienced ruby
| coder... I'm sure there's a reason for that code:
|
| to_s normalizes code down to a string that can be compared when
| the object could be arbitrary and might not implement ==
|
| init is one of the three core framework methods for the elm
| pattern.
| marcoroth wrote:
| Thanks for the feedback!
|
| And yeah, I agree. I'm not super happy with some of the APIs as
| they aren't really idiomatic Ruby. It's also something I
| mentioned in the blog post that I want to improve:
| https://marcoroth.dev/posts/glamorous-christmas
|
| For now, I just wanted to get them out so we as a community can
| build them out together. Most of the APIs are just 1:1 "ports"
| of their Go counterparts and might feel off or a bit too low
| level because of that.
| mrinterweb wrote:
| Ruby is my favorite language for writing CLI scripts/apps. I've
| been feeling the TUI options for ruby feel a bit dated, and I've
| been secretly wanting charm for ruby for a while. I'm very
| excited to use this.
| nona wrote:
| Looks great, I'm definitely going to have a look at it.
|
| Off-topic: it'd be nice to have a configuration spec to define
| the look (and maybe even the behaviour) of the different CLI &
| TUI libraries out there. For things like
| colours/borders/corners/shadows/scroll- & progressbars etc.
|
| Right now every library does its own thing, which can be quite
| jarring when using different apps.
| marcoroth wrote:
| I guess, to a degree, this is what lipgloss is trying to
| be/solve: https://github.com/marcoroth/lipgloss-ruby
| nona wrote:
| To a degree, yes, but I was thinking something in the line of
| a commonly agreed on file format that defines a default
| style. To be used by libraries like charm, ratatui, tty, heck
| maybe even older ones like libnewt etc.
|
| A bit like base16 but with more definitions and better
| semantics.
___________________________________________________________________
(page generated 2025-12-30 23:01 UTC)