CLI Template
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am "Add some feature"
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request