Replr: Easy Command-line REPLs

I built a small utility this week to help anybody start a REPL in any language stack[1], with any libraries of their choosing. It’s built on top of docker, and it was a fun exercise for a couple of days to build something that’s I’ll personally use quite a lot when trying out new Ruby gems.

So instead of creating a Gemfile, making sure that its syntax is correct, installing the version of Ruby you’d like via rvm, instead, you just type in a single command:

replr ruby chronic

& your REPL is ready!

Do check it out at Github and gem install replr

A few things I learnt while building this:

  • I wanted to keep dependencies low (because this is something people will install as a binary into their machines), so I did all the argument parsing et. al. manually. It’s not that hard or clumsy at all. replr currently has 0 dependencies.
  • I used Visual Studio Code as the editor for building this, and its quickly becoming my go-to editor for every kind of code editing. I was one of the last few folks holdouts at Textmate 2, and while VSCode is still not native enough for my tastes, the breadth & depth of its editor and tooling integration is hard to live without now.
  • Speaking of VSCode integration, I’ve heavily used the Ruby editor integration to make sure code conforms to Rubocop​ guidelines. It’s nowhere near as good as Prettier​ on JavaScript though. Prettier just has you spoilt with its auto-formatting & opinionated code rewriting. I feel Ruby can really use a tool like that.

[1]: Well, it currently just supports Ruby, but am planning to add new stacks soon!

Leave a Reply