Sha256: 26dda996aba1d1ee752859513659e37e2b3567f6b4a9f27f4d29391200ca2710

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

module Gator
  class Command < Thor
    def self.register_command(target, name, usage, description, mappings=[], options={})
      target.register self, name, usage, description, options
      target.map mappings => name
    end

    #The following lines fixes 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

2 entries across 2 versions & 1 rubygems

Version Path
gator-0.0.13.pre lib/gator/command.rb
gator-0.0.12.pre lib/gator/command.rb