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
30 31 32 |
# File 'lib/hammer_cli/full_help.rb', line 30 def command_name(parent, command_name) "#{parent} #{command_name}" end |
#print_command(name, description, help) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/hammer_cli/full_help.rb', line 34 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
54 55 56 |
# File 'lib/hammer_cli/full_help.rb', line 54 def print_heading(text, level=1) puts '#'*level + ' ' + text end |
#print_toc(cmd) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/hammer_cli/full_help.rb', line 44 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 |