class HammerCLI::FullHelpCommand
Public Instance Methods
execute()
click to toggle source
# File lib/hammer_cli/full_help.rb, line 7 def execute @adapter = option_md? ? MDAdapter.new : TxtAdapter.new HammerCLI.context[:full_help] = true @invocation_paths = {} print_heading print_help HammerCLI.context[:full_help] = false HammerCLI::EX_OK end
Private Instance Methods
print_heading()
click to toggle source
# File lib/hammer_cli/full_help.rb, line 19 def print_heading @adapter.print_heading(_('Hammer CLI help')) @adapter.print_toc(HammerCLI::MainCommand) end
print_help(name='hammer', command=HammerCLI::MainCommand, desc='')
click to toggle source
# File lib/hammer_cli/full_help.rb, line 24 def print_help(name='hammer', command=HammerCLI::MainCommand, desc='') @invocation_paths[name] ||= [] @adapter.print_command(name, desc, command.new(name, path: @invocation_paths[name]).help) command.recognised_subcommands.each do |sub_cmd| path = "#{name} #{sub_cmd.names.first}" @invocation_paths[path] ||= [] @invocation_paths[path] += @invocation_paths[name] print_help(@adapter.command_name(name, sub_cmd.names.first), sub_cmd.subcommand_class, sub_cmd.description) end end