Class: Relish::Command::Help

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

Instance Attribute Summary

Attributes inherited from Base

#args, #cli_options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#get_param, #initialize, #url

Methods included from Dsl

#option, #option_names, #option_names_to_display

Constructor Details

This class inherits a constructor from Relish::Command::Base

Class Method Details

.command_helpObject



11
12
13
# File 'lib/relish/commands/help.rb', line 11

def command_help
  @command_help ||= {}
end

.for_command(command, help) ⇒ Object



7
8
9
# File 'lib/relish/commands/help.rb', line 7

def for_command(command, help)
  command_help[command] = help
end

Instance Method Details

#defaultObject



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

def default
  puts "This is the prefunctory help message for the relish gem."

  puts "Commands:"
  Help.command_help.each do |command, help|
    message = "relish #{command}".ljust(max_command_length) + 
              " # " + help
    puts message
  end
end

#max_command_lengthObject



27
28
29
# File 'lib/relish/commands/help.rb', line 27

def max_command_length
  Help.command_help.keys.map { |c| c.to_s.length }.max
end