CLI Template

CircleCI Maintainability

cli-template is a generator tool that builds a starter CLI project based on Thor. It is the successor tool to thor_template, which is also a tool that generates CLI projects. The main difference is cli-template allows for namespace commands. The usage section demonstrates a namespace command below.

The predecessor tool is covered in this original blog post, Build Thor CLI Project in Under a Second. It covers usage and also contains a video demo. An updated blog post will eventually be made, for now, refer to the original blog post.

Usage

cli-template new mycli
cd mycli
exe/mycli hello world
exe/mycli sub:goodbye world

The above generated a starter CLI project called mycli with a working hello command. The created project also has starter specs for you 😁

$ rake
Mycli::CLI
  mycli
    should hello world
    should goodbye world

Finished in 1.12 seconds (files took 0.71706 seconds to load)
2 examples, 0 failures

Release

Once you are satisfied with the CLI tool, you can release it as a gem.

1. edit the mycli.gemspec
2. edit lib/mycli/version.rb
3. update the CHANGELOG.md

And run:

rake release

Installation

gem install cli-template

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am "Add some feature")
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request