Class: HammerCLI::Subcommand::Definition
- Inherits:
-
Clamp::Subcommand::Definition
- Object
- Clamp::Subcommand::Definition
- HammerCLI::Subcommand::Definition
- Defined in:
- lib/hammer_cli/subcommand.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#warning ⇒ Object
readonly
Returns the value of attribute warning.
Instance Method Summary collapse
- #help ⇒ Object
- #hidden? ⇒ Boolean
-
#initialize(names, description, subcommand_class, options = {}) ⇒ Definition
constructor
A new instance of Definition.
- #subcommand_class ⇒ Object
Constructor Details
#initialize(names, description, subcommand_class, options = {}) ⇒ Definition
Returns a new instance of Definition.
8 9 10 11 12 13 14 15 |
# File 'lib/hammer_cli/subcommand.rb', line 8 def initialize(names, description, subcommand_class, = {}) @names = Array(names) @description = description @subcommand_class = subcommand_class @hidden = [:hidden] @warning = [:warning] super(@names, @description, @subcommand_class) end |
Instance Attribute Details
#warning ⇒ Object (readonly)
Returns the value of attribute warning.
32 33 34 |
# File 'lib/hammer_cli/subcommand.rb', line 32 def warning @warning end |
Instance Method Details
#help ⇒ Object
27 28 29 30 |
# File 'lib/hammer_cli/subcommand.rb', line 27 def help names = HammerCLI.context[:full_help] ? @names.join(", ") : @names.first [names, description] end |
#hidden? ⇒ Boolean
17 18 19 |
# File 'lib/hammer_cli/subcommand.rb', line 17 def hidden? @hidden end |
#subcommand_class ⇒ Object
21 22 23 24 25 |
# File 'lib/hammer_cli/subcommand.rb', line 21 def subcommand_class @warning ||= @subcommand_class.warning warn(@warning) if @warning @subcommand_class end |