class R2do::Commands::HelpCommand

Public Class Methods

new(cmd_list) click to toggle source
Calls superclass method R2do::Command::new
# File lib/r2do/commands/help_command.rb, line 21
def initialize(cmd_list)
  super('h', 'help', 'Shows the help for a given command')

  @cmd_list = cmd_list
end

Public Instance Methods

execute(args) click to toggle source

Initializes the applications and resets the datafile

@param [Array] args the arguments passed to the app by the user @return [void]

# File lib/r2do/commands/help_command.rb, line 31
def execute(args)
  argument = args[1]

  cmd = @cmd_list.find { |c| c.short == argument or c.extended == argument }
  if cmd.nil?
    raise InvalidCommandError, "Invalid command. See 'r2do -h'"
  end

  UI.status(cmd.help())
end