0.0
No commit activity in last 3 years
No release in over 3 years
Minimalistic framework for constructing shell-like applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

Shellissimo

Build Status Coverage Status Code Climate Gem Version

Minimalistic framework for constructing shell-like applications.

Installation

Add this line to your application's Gemfile:

gem 'shellissimo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install shellissimo

Usage

Create your shell by sublcassing Shellissimo::Shell

require 'shellissimo'

class Greeter; def say_hi(name, title); "hi #{title} #{name}"; end; end

class MyShell < Shellissimo::Shell
  command :hi do |c|
    c.description "Says hello to the user"
    c.mandatory_param(:user) do |p|
      p.description "User name"
      p.validate { |v| !v.to_s.strip.empty? }
    end
    c.param(:title) do |p|
      p.validate { |v| %w(Mr. Ms.).include?(v.to_s) }
    end
    c.run { |params| @greeter.say_hi(params[:user], params[:title]) }
  end

  def initialize
    @greeter = Greeter.new
    super
  end
end

MyShell.new.run

In this example help message would look like:

Available commands:

hi                               - Says hello to the user
  user                           - User name - mandatory
  title                          - optional

help (aliases: h)                - Show available commands
quit (aliases: exit)             - Quit irb

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