Class: Komonzu::CLI
- Inherits:
-
Thor
- Object
- Thor
- Komonzu::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/komonzu/cli.rb
Class Method Summary collapse
Class Method Details
.register(klass, name, usage, description, opts = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/komonzu/cli.rb', line 15 def self.register(klass, name, usage, description, opts=nil) opts ||= {} if klass <= Command::GroupBase # A subclass of GroupBase is a subcommand, since it contains # many smaller commands within it. desc usage, description, opts subcommand name, klass elsif klass <= Command::Base # A subclass of Base is a single command, since it # is invoked as a whole (as Thor::Group) desc usage, description, opts define_method(name) { |*args| invoke klass, args } end end |