from Hacker News

Show HN: Shelgon: A Framework for Building Interactive REPL Shells in Rust

by cat-whisperer on 3/6/25, 7:32 PM with 25 comments

I've been working on Shelgon, a framework that lets you build your own custom REPL shells and interactive CLI applications in Rust.

You can use Shelgon to:

- Create a custom shell with only a few lines of code - Build interactive debugging tools with persistent state between commands - Develop domain-specific language interpreters with shell-like interfaces - Add REPL capabilities to existing applications

Getting started is straightforward - implement a single trait that handles your command execution logic, and Shelgon takes care of the terminal UI, input handling, and async runtime integration.

For example, a simple echo shell takes less than 50 lines of code, including a full implementation of command history, cursor movement, and tab completion.

Repository: https://github.com/nishantjoshi00/shelgon

  • by bfLives on 3/6/25, 8:52 PM

    Looks really interesting. I like the approach of writing pure functions that return descriptions of IO tasks to perform. A couple of questions:

    1. Why async?

    2. Why couple to anyhow instead of using an associated error type?

  • by cmrdporcupine on 3/6/25, 8:50 PM

    Neat. I'll check it out.

    One suggestions: the README advertises lovely TUIs. Show us a screenshot, or screencast, so we can see what you mean!

  • by faizshah on 3/7/25, 9:10 AM

    This is awesome, there’s a really nice one in python called prompt toolkit that has some a nice api as well: https://python-prompt-toolkit.readthedocs.io/en/master/
  • by serial_dev on 3/7/25, 5:28 AM

    Interesting stuff!

    Video or gif would be nice! It’s like a UI library need at least a screenshot, this thing needs a video demo of sorts.

    Q: why write that the docs is by LLM? In my opinion if it’s correct, and it makes sense, I don’t care even if an alien gave it to you.

  • by hkalbasi on 3/6/25, 8:45 PM

    How it compares to other libraries in this space, e.g. reedline or rustyline?
  • by ilikegreen on 3/6/25, 9:17 PM

    Please don't mind my possibly simplistic question — but is this something that would bring Rust development closer to a Lisp environment? Seems like an interesting project.
  • by hajimuz on 3/11/25, 3:29 AM

    A quick demo or screenshot would be nice!
  • by jiaaro on 3/6/25, 10:32 PM

    Cool project! But, I wonder how long can a project like this use a Pokemon as their namesake and mascot before you hear from nintendo's lawyers?