cliqr
Table of Contents
Summary
cliqr
is a lightweight yet feature rich framework which can be used to
build a powerful command line application. It provides a easy to use DSL
to define the interface of a application. Some of the features included:
- Quick and easy method for defining CLI interface
- Command usage generation based on interface definition
- Argument parsing
- Argument validation
- Nested command actions
- Multiple command handler based on arguments
- Command routing to appropriate handler
- Inbuilt shell extension for your command
Examples
The DSL provides several helper methods to build interfaces of different
styles. Please refer to the examples folder to find some useful tips on
how to use cliqr
.
Quickstart
To get things started quickly here is an example of a basic cliqr
based CLI application (lets call this script greet
):
#!/usr/bin/env ruby
require 'cliqr'
cli = Cliqr.interface do
name 'greet'
description 'A "hello world" app to demonstrate cliqr.'
version '0.0.1'
handler do
puts "Hi #{name}" if name?
puts "Please tell me your name" unless name?
end
option :name do
description 'Your name.'
end
end
cli.execute(ARGV)
Here is a screen capture of this script in action:
Installation
Add this line to your application's Gemfile:
gem 'cliqr'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cliqr
Building
There are various metric with different thresholds settings that needed
to be satisfied for a successful build. Here is a list:
rubocop
to make sure the code style checks are maintainedyardstick
to measure document coveragecodeclimate
to make we ship quality codecoveralls
to measure code coveragerdoc
to build and measure documentation
To run all of the above, simply run:
$ rake
Contributing
- Fork it ( https://github.com/anshulverma/cliqr/fork )
- 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 a new Pull Request