Class: HammerCLI::FullHelpCommand::MDAdapter
- Inherits:
-
Object
- Object
- HammerCLI::FullHelpCommand::MDAdapter
- Defined in:
- lib/hammer_cli/full_help.rb
Instance Method Summary collapse
- #command_name(parent, command_name) ⇒ Object
- #print_command(name, description, help) ⇒ Object
- #print_heading(text, level = 1) ⇒ Object
- #print_toc(cmd) ⇒ Object
Instance Method Details
#command_name(parent, command_name) ⇒ Object
37 38 39 |
# File 'lib/hammer_cli/full_help.rb', line 37 def command_name(parent, command_name) "#{parent} #{command_name}" end |
#print_command(name, description, help) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/hammer_cli/full_help.rb', line 41 def print_command(name, description, help) print_heading(name, name.split.length) puts description puts puts "```" puts help puts "```" puts end |
#print_heading(text, level = 1) ⇒ Object
61 62 63 |
# File 'lib/hammer_cli/full_help.rb', line 61 def print_heading(text, level=1) puts '#'*level + ' ' + text end |
#print_toc(cmd) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/hammer_cli/full_help.rb', line 51 def print_toc(cmd) names = cmd.recognised_subcommands.collect do |sub_cmd| sub_cmd.names[0] end names.sort.each do |name| puts "- [%s](#hammer-%s)" % [name, name.gsub(' ', '-')] end puts end |