Class: Tlog::Command::Help
Instance Attribute Summary
#date_time_format, #seconds_format, #storage
Instance Method Summary
collapse
Instance Method Details
#description ⇒ Object
8
9
10
|
# File 'lib/tlog/command/help.rb', line 8
def description
"outputs lists of commands and their descriptions"
end
|
#execute(input, output) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# 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 ⇒ Object
4
5
6
|
# File 'lib/tlog/command/help.rb', line 4
def name
"help"
end
|
#options(parser, options) ⇒ Object
34
35
36
|
# File 'lib/tlog/command/help.rb', line 34
def options(parser, options)
parser.banner = "usage: tlog help"
end
|