Class: Hookers::Commands::Help

Inherits:
Object
  • Object
show all
Includes:
Hookers::Command
Defined in:
lib/hookers/commands/help.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Hookers::Command

included, #parse_options

Constructor Details

#initialize(command, args) ⇒ Help

Returns a new instance of Help.



10
11
12
# File 'lib/hookers/commands/help.rb', line 10

def initialize(command, args)
  self.args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/hookers/commands/help.rb', line 8

def args
  @args
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hookers/commands/help.rb', line 14

def run
  if args.length == 0 || Hookers.commands[args[0]] == nil
    puts "Use hookers help <command> for additional options\nAvailable commands: "
    Hookers.commands.keys.each { |k| puts "\t#{k}" }
    return
  end

  if Hookers.commands[args[0]] && Hookers.commands[args[0]].respond_to?(:slop)
    puts Hookers.commands[args[0]].slop.help
  end
end