Class: Thunder::DefaultHelp
- Inherits:
-
Object
- Object
- Thunder::DefaultHelp
- Defined in:
- lib/thunder/help/default.rb
Overview
Provides an easy to parse help formatter
Class Method Summary collapse
Class Method Details
.help_command(command_spec) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/thunder/help/default.rb', line 6 def help_command(command_spec) preamble = determine_preamble = "" << command_spec[:description] + "\n" if command_spec[:description] << command_spec[:long_description] + "\n" if command_spec[:long_description] << "\n" + (command_spec[:options]) if command_spec[:options] output = "Usage:\n \#{preamble} \#{command_spec[:usage]}\n\n\#{footer.strip}\n EOS\n output.rstrip\nend\n" |
.help_list(commands) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/thunder/help/default.rb', line 22 def help_list(commands) preamble = determine_preamble help = [] commands.each do |name, command_spec| help << short_help(preamble, command_spec) end render_table(help) end |