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',
  e: 'show_ext',
  ext: 'show_ext',
  l: 'show_lib',
  lib: 'show_lib',
  library: 'show_lib',
  libraries: 'show_lib',
  extension: 'show_ext',
  extensions: 'show_ext'
}.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.



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

def self.keyword
  return KEYWORD
end

.keyword_shortcutObject

Get the Verb’s keyword shortcut.



60
61
62
# File 'lib/gloo/verbs/help.rb', line 60

def self.keyword_shortcut
  return KEYWORD_SHORT
end

Instance Method Details

#runObject

Run the verb.



39
40
41
42
43
44
45
46
47
48
# File 'lib/gloo/verbs/help.rb', line 39

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

  if opts
    dispatch opts
  else
    show_default_help
  end
end