Project

cliqr

0.01
No commit activity in last 3 years
No release in over 3 years
Allows you to easily define the interface for a CLI app using an easy to use DSL. Includes a lightweight framework for a CLI app. Features: command routing, error handling, usage generation...more to come
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6

Runtime

~> 1.0.0
 Project Readme

cliqr Version

Build Coveralls Quality Dependencies Inline docs Downloads

Table of Contents

  • cliqr
    • Summary
    • Examples
    • Quickstart
    • Installation
    • Building
    • Contributing

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' # optional; adds a version action to our simple command

  # main command handler
  handler do
    puts "Hi #{name}" if name? # name is command's option defined below
    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: greet script demo

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 maintained
  • yardstick to measure document coverage
  • codeclimate to make sure we ship quality code
  • coveralls to measure code coverage
  • rdoc to build and measure documentation

To run all of the above, simply run:

$ rake

Contributing

  1. Fork it ( https://github.com/anshulverma/cliqr/fork )
  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 a new Pull Request