Class: Downloads::Commands::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/downloads/commands/help.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#configuration, #local, #options, #remote

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

command_name, inherited, #initialize, #usage, #valid?

Constructor Details

This class inherits a constructor from Downloads::Commands::Base

Instance Attribute Details

#commandObject

Returns the value of attribute command.



4
5
6
# File 'lib/downloads/commands/help.rb', line 4

def command
  @command
end

Class Method Details

.usageObject



6
7
8
# File 'lib/downloads/commands/help.rb', line 6

def self.usage
  "#{super} [COMMAND]"
end

Instance Method Details

#configure(argv) ⇒ Object



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

def configure(argv)
  self.command = shift_argument(argv)
end

#runObject



14
15
16
17
18
19
20
# File 'lib/downloads/commands/help.rb', line 14

def run
  if command
    puts Commands.registry[command].usage
  else
    puts Commands.objects.map { |command| command.usage }
  end
end