class Tlog::Command::Help

Public Instance Methods

description() click to toggle source
# File lib/tlog/command/help.rb, line 8
def description
  "outputs lists of commands and their descriptions"
end
execute(input, output) click to toggle source
# File lib/tlog/command/help.rb, line 12
def execute(input, output)
  commands = Tlog::Command_Suite.commands
  commands.sort! {|a,b| a.name <=> b.name}
  max_name_length = 0

  commands.each do |command|
    name_length = command.name.length
    max_name_length = name_length if name_length > max_name_length 
  end

  output.line("usage: tlog <command>")
  output.line(nil)

  commands.each do |command|
    line = sprintf("%-#{max_name_length}s  %s", command.name, command.description)
    output.line(line)
  end

  output.line(nil)
  return true
end
name() click to toggle source
# File lib/tlog/command/help.rb, line 4
def name
  "help"
end
options(parser, options) click to toggle source
# File lib/tlog/command/help.rb, line 34
def options(parser, options)
  parser.banner = "usage: tlog help"
end