Building a Sub-command Ruby CLI with just OptionParser

I’ve thought deeply about building CLIs and built a lot of them over the years. I’ve used Rake, Thor, my own gem GLI and many others. After all that, the venerable OptionParser —part of Ruby’s standard library—is the best choice for scripting and sub-command (git-like) CLIs. I want to show you how. What is a Sub-Command CLI? At first glance, OptionParser doesn’t seem to support a sub-command CLI,…