Class: Ing::Commands::Help

Inherits:
Object
  • Object
show all
Includes:
Ing::CommonOptions
Defined in:
lib/ing/commands/help.rb

Constant Summary collapse

DEFAULTS =
{
   namespace: 'ing:commands',
   ing_file:  'ing.rb'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Ing::CommonOptions

#debug, #debug?, included, #ing_file, #namespace, #require_ing_file, #require_libs, #requires

Constructor Details

#initialize(options) ⇒ Help

Returns a new instance of Help.



28
29
30
# File 'lib/ing/commands/help.rb', line 28

def initialize(options)
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



21
22
23
# File 'lib/ing/commands/help.rb', line 21

def options
  @options
end

#shellObject



24
25
26
# File 'lib/ing/commands/help.rb', line 24

def shell
  @shell ||= ::Ing.shell_class.new
end

Class Method Details

.specify_options(parser) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/ing/commands/help.rb', line 11

def self.specify_options(parser)
  parser.text "Display help on specified command"
  parser.text "\nUsage:"
  parser.text "  ing help generate               # help on built-in command generate"
  parser.text "  ing help --namespace test unit  # help on command within namespace"
  parser.text "  ing help                        # display this message"
end

Instance Method Details

#beforeObject

Require each passed file or library before running and require the ing file if it exists



34
35
36
37
# File 'lib/ing/commands/help.rb', line 34

def before
  require_libs
  require_ing_file
end

#call(cmd = "help") ⇒ Object



39
40
41
42
43
44
# File 'lib/ing/commands/help.rb', line 39

def call(cmd="help")      
  before
  klass         = Util.decode_class(cmd, _namespace_class)
  help = Command.new(klass).help
  shell.say help
end