Class: Thor
- Inherits:
-
Object
- Object
- Thor
- Defined in:
- lib/cloudstack-cli/thor_patch.rb
Overview
Fixes thor help for subcommands github.com/erikhuda/thor/pull/330
Direct Known Subclasses
Class Attribute Summary collapse
-
.parent_class ⇒ Object
Returns the value of attribute parent_class.
Class Method Summary collapse
- .banner(command, namespace = nil, subcommand = false) ⇒ Object
- .basename2(subcommand = false) ⇒ Object
- .old_subcommand ⇒ Object
- .subcommand(subcommand, subcommand_class) ⇒ Object
Class Attribute Details
.parent_class ⇒ Object
Returns the value of attribute parent_class.
6 7 8 |
# File 'lib/cloudstack-cli/thor_patch.rb', line 6 def parent_class @parent_class end |
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
15 16 17 |
# File 'lib/cloudstack-cli/thor_patch.rb', line 15 def (command, namespace = nil, subcommand = false) "#{basename2(subcommand)} #{command.formatted_usage(self, $thor_runner, subcommand)}" end |
.basename2(subcommand = false) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/cloudstack-cli/thor_patch.rb', line 8 def basename2(subcommand = false) bn = parent_class && parent_class.basename2 bn2 = basename ns = self.namespace.split(':').last bn ? (subcommand ? bn : "#{bn} #{ns}") : bn2 end |
.old_subcommand ⇒ Object
19 |
# File 'lib/cloudstack-cli/thor_patch.rb', line 19 alias :old_subcommand :subcommand |
.subcommand(subcommand, subcommand_class) ⇒ Object
21 22 23 24 |
# File 'lib/cloudstack-cli/thor_patch.rb', line 21 def subcommand(subcommand, subcommand_class) subcommand_class.parent_class = self old_subcommand(subcommand, subcommand_class) end |