Class: Thor

Inherits:
Object
  • Object
show all
Defined in:
lib/thor_register_patch.rb

Overview

this is a patch to register subcommands in Thor. there’s a pull-request for this so it is only temporary until that is done

Class Method Summary collapse

Class Method Details

.register(klass, subcommand_name, usage, description, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/thor_register_patch.rb', line 6

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