Fantastic Gem for CLI Applications

If you’re going to build a CLI application in Ruby, you owe it to yourself to look into the gli gem. Especially if you’re considering building a CLI application that has subcommands, i.e. Git style. I’ve done the research on Ruby Toolbox and came out with several options.

  • Thor - this almost won out, but the help text didn’t cut it. Things like --help at the end of a subcommand don’t work either.
  • Slop - no support for subcommands in version 4.
  • Cocaine - no great help text, not fantastic for subcommands.
  • Trollop - Lacking in documentation, less active.
  • commander - not as active as I’d like, maintainer tj went to Node, then Go. It also seemed too heavy weight for my needs, and again the helper text wasn’t as nice. This is still a nice option.

The gli gem seemed to have it all: subcommands, required args, global options vs command options, and of course very nice help output.