lib/gator/command.rb in gator-0.0.13.pre vs lib/gator/command.rb in gator-0.0.14.pre
- old
+ new
@@ -1,12 +1,14 @@
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
+
+ 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 fixes a bug in thor see: https://github.com/wycats/thor/pull/150
+ #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 }
\ No newline at end of file