Class: Gloo::Verbs::Help

Inherits:
Core::Verb show all
Defined in:
lib/gloo/verbs/help.rb

Constant Summary collapse

KEYWORD =
'help'.freeze
KEYWORD_SHORT =
'?'.freeze
DEFAULT_HELP =
'default_help'.freeze
HELP_NOT_FOUND_ERR =
'Help command could not be found:'.freeze
DISPATCH =
{
  s: 'show_settings',
  settings: 'show_settings',
  verb: 'show_verbs',
  verbs: 'show_verbs',
  v: 'show_verbs',
  o: 'show_objs',
  obj: 'show_objs',
  object: 'show_objs',
  objects: 'show_objs'
}.freeze

Constants inherited from Core::Baseo

Core::Baseo::NOT_IMPLEMENTED_ERR

Instance Attribute Summary

Attributes inherited from Core::Verb

#params, #tokens

Attributes inherited from Core::Baseo

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Verb

#display_value, help, inherited, #initialize, #type_display

Methods inherited from Core::Baseo

#initialize, #type_display

Constructor Details

This class inherits a constructor from Gloo::Core::Verb

Class Method Details

.keywordObject

Get the Verb’s keyword.



45
46
47
# File 'lib/gloo/verbs/help.rb', line 45

def self.keyword
  return KEYWORD
end

.keyword_shortcutObject

Get the Verb’s keyword shortcut.



52
53
54
# File 'lib/gloo/verbs/help.rb', line 52

def self.keyword_shortcut
  return KEYWORD_SHORT
end

Instance Method Details

#runObject

Run the verb.



31
32
33
34
35
36
37
38
39
40
# File 'lib/gloo/verbs/help.rb', line 31

def run
  opts = @tokens.second if @tokens
  opts = opts.strip.downcase if opts

  if opts
    dispatch opts
  else
    show_default_help
  end
end