Sha256: 36d07f9f34bbf6b738915a00375581f58db87e215c44a3e9fc881d2c96466364

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

module Gator
  class Command < Thor

    def self.define( definition )
      @definition = d = definition
      d[:on].register self, d[:as], d[:usage], d[:description], d[:options] || {}
      d[:on].map [ d[:short] ] => d[:as] unless d[:short].nil?
    end

    #The following lines fix a bug in thor see: https://github.com/wycats/thor/pull/150
    class << self
      def register(klass, subcommand_name, usage, description, options={})
        if klass <= Thor::Group
          desc usage, description, options
          define_method(subcommand_name) { |*args| invoke klass }
        else
          desc usage, description, options
          subcommand subcommand_name, klass
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gator-0.0.14.pre lib/gator/command.rb