command-line-utils

This is a command line utilites.

Base classes

  • CommandLineUtils::CLI

  • CommandLineUtils::Commands

Simple Usage

require 'command-line-utils' 
module _YourCommand_
  class CLI < CommandLineUtils::CLI
    def initialize
      super
      @commands = Commands.new
    end
  end
  class Commands < CommandLineUtils::Commands
    def _your_command_
      OptionParser.new{ |opt|
        opt.on('-o','--long-option', 'about option') { ... }
      }.parse!(@command_options)
      @summery = "This is a sample option."
      @banner = "[-o|--long-option]"
      return opt if @help

      # your commands ...

    end
  end
end

executable template

Put your command under bin directory.

#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__),'..','lib')
require 'unit-hosting/cli'
_YourCommand_::CLI::run(ARGV)
exit

Install

sudo gem install command-line-utils

Contributing to command-line-utils

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Yoshihiro TAKAHARA. See LICENSE.txt for further details.

<img src=“http://api.coderwall.com/tumf/endorsecount.png”/>