Class: Ing::Commands::Help
- Inherits:
-
Object
- Object
- Ing::Commands::Help
- 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
-
#options ⇒ Object
Returns the value of attribute options.
- #shell ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
-
#before ⇒ Object
Require each passed file or library before running and require the ing file if it exists.
- #call(cmd = nil) ⇒ Object
-
#initialize(options) ⇒ Help
constructor
A new instance of Help.
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.
30 31 32 |
# File 'lib/ing/commands/help.rb', line 30 def initialize() self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
23 24 25 |
# File 'lib/ing/commands/help.rb', line 23 def @options end |
#shell ⇒ Object
26 27 28 |
# File 'lib/ing/commands/help.rb', line 26 def shell @shell ||= ::Ing.shell_class.new end |
Class Method Details
.specify_options(parser) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/ing/commands/help.rb', line 11 def self.(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 unit --namespace test # help on command 'unit' within namespace 'test'" parser.text " ing help --namespace test:unit # another syntax" parser.text " ing help test:unit # yet another syntax" parser.text " ing help # display this message" end |
Instance Method Details
#before ⇒ Object
Require each passed file or library before running and require the ing file if it exists
36 37 38 39 |
# File 'lib/ing/commands/help.rb', line 36 def before require_libs require_ing_file end |
#call(cmd = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ing/commands/help.rb', line 41 def call(cmd=nil) before if [:namespace_given] if cmd _do_help cmd, _namespace_class else _do_help _namespace_class end else if cmd if /:/ =~ cmd _do_help cmd else _do_help cmd, _namespace_class end else _do_help 'help', _namespace_class end end end |