Class: VagrantPlugins::DevCommands::InternalCommand::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/devcommands/internal_command/help.rb

Overview

Internal “help” command

Constant Summary collapse

UTIL =
VagrantPlugins::DevCommands::Util
MESSAGES =
VagrantPlugins::DevCommands::Messages

Instance Method Summary collapse

Constructor Details

#initialize(env, registry) ⇒ Help

Returns a new instance of Help.



9
10
11
12
# File 'lib/vagrant/devcommands/internal_command/help.rb', line 9

def initialize(env, registry)
  @env      = env
  @registry = registry
end

Instance Method Details

#execute(argv) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant/devcommands/internal_command/help.rb', line 14

def execute(argv)
  return message(:no_commands) if @registry.commands.empty?

  command = argv[0]

  return plugin_help(command) unless @registry.valid_command?(command)
  return internal_help(command) if @registry.reserved_command?(command)

  command_help(command)
end