Writing Awesome CLI Tools in Ruby: Part II


This is Part II of my series on writing awesome CLI (command line interface) tools using ruby (Part I). In the first part I described how to create your project layout, add an executable binary, and get started. In this next part I will cover:

  • How to structure your code to be usable as both a tool and a library
  • Building your CLI frontend to your library.

Writing Awesome CLI Tools in Ruby: Part I



I am always writing small tools to help me out on a daily basis. Sometimes shell scripts, but
other times I want something a bit more complex. When I need more than a simple shell script, I like to leverage ruby for its vast library of gems which can greatly accelerate and simplify the task of building these helpful tools.

This post will give an introduction to writing your own CLI tools in ruby and packaging them
as a gem.