Class: Vito::Commands::Help

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

Instance Method Summary collapse

Constructor Details

#initialize(command_line) ⇒ Help

Returns a new instance of Help.



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

def initialize(command_line)
  @command_line = command_line
end

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vito/commands/help.rb', line 8

def perform
  output = ""

  output << "Usage: vito [COMMAND] [OPTIONS]\n"
  output << "\n"
  output << "Options:\n"
  output << "\n"

  available_options.each do |option|
    output << "\s\s"
    output << option[0].join(", ")
    output << ("\s" * tabs_needed_for_flags(option[0]))
    output << "\s\s"
    output << option[1]
    output << "\n"
  end

  puts output
end