class Dracula::CommandHelp

Public Class Methods

new(command) click to toggle source
# File lib/dracula/command_help.rb, line 4
def initialize(command)
  @command = command
end

Public Instance Methods

show() click to toggle source
# File lib/dracula/command_help.rb, line 8
def show
  show_usage
  show_desc
  show_flags     if @command.flags.any?
  show_long_desc if @command.long_desc
end

Private Instance Methods

banner() click to toggle source
show_desc() click to toggle source
# File lib/dracula/command_help.rb, line 38
def show_desc
  puts @command.desc.description.capitalize
  puts ""
end
show_flags() click to toggle source
# File lib/dracula/command_help.rb, line 43
def show_flags
  puts Dracula::UI.bold("Flags:")

  flags = @command.flags.map do |flag|
    [flag.banner, flag.description]
  end

  Dracula::UI.print_table(flags, :indent => 2)

  puts ""
end
show_long_desc() click to toggle source
# File lib/dracula/command_help.rb, line 55
def show_long_desc
  puts @command.long_desc
end
show_usage() click to toggle source
# File lib/dracula/command_help.rb, line 33
def show_usage
  puts "Usage: #{Dracula.program_name} #{banner}"
  puts ""
end