Garnish - A Terminal UI Framework for SSH based applications

Garnish is a Terminal UI Framework based on the Ratatouille view architecture, but adapted for Erlang’s ssh framework.

Sitting on :ssh - as an ssh_cli server channel - allows secure remote access to the Elixir app. The view architecture, shamelessly copied from Ratatouille, enables simple TUI apps to be built, typically for operator/admin experiences (which is the use case I have). Under the covers, the logical render of the view is translated into terminal escape sequences. This is also removes the need for the ex_termbox NIF that Ratatouille required.

I did diverge a little the app model, which I made a little more idiomatic from an OTP perspective, but the view modules and the render/1 callback are exactly as they were in Ratatouille.

This is the initial early release, expect some rough edges. EDIT: Notably, it only supports xterm-256color right now and is untested on other terminals, but it will pretty easy to add others, which I plan to do.

17 Likes

I’m using this library on two different projects at the moment, and wanted to share how helpful it’s been. Exposing a TUI dashboard over SSH is tremendously valuable, and I look forward to future developments!

2 Likes

This is so cool! A modern foundation of text BBS and MUD, anyone? I had similar idea awhile back but got intimidated by the amount of work it would require. Thanks again for the library; I will use it in a future project.

Have you connected with the author of Ratatouille? It would make a lot of sense if you can work together to extract out the view layer as a separate library.

Another idea is to fuse the Mosh server with Garnish, so client can connect with mosh client instead of ssh to enjoy roaming, auto-reconnecting, and latency optimization. It will be a lot of work but the benefit is huge.

3 Likes

Garnish is exactly the ratatouille view framework with some module renaming. I spoke to the author and he was happy to see the code reused.

The rendering code is more expensive than I’d like but it’s fine for a few users which is my use-case, so I’m unlikely to invest too much time chasing this down.

1 Like

As to extracting the code as a library this would be straightforward but not currently on my todo list

Curious to see this project in action, but the Asciinema recording on the GitHub project page seems to have expired.

2 Likes

Oh I didn’t even realise that was a thing, thx for letting me know

2 Likes