Class: GLI::Commands::Help
- Defined in:
- lib/doing/help_monkey_patch.rb
Overview
Help Command Monkeypatch for paginated output
Instance Method Summary collapse
Instance Method Details
#show_help(global_options, options, arguments, out, error) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/doing/help_monkey_patch.rb', line 7 def show_help(, , arguments, out, error) Doing::Pager.paginate = true command_finder = HelpModules::CommandFinder.new(@app, arguments, error) if [:c] help_output = HelpModules::HelpCompletionFormat.new(@app, command_finder, arguments).format out.puts help_output unless help_output.nil? elsif arguments.empty? || [:c] Doing::Pager.page HelpModules::GlobalHelpFormat.new(@app, @sorter, @text_wrapping_class).format else name = arguments.shift command = command_finder.find_command(name) unless command.nil? Doing::Pager.page HelpModules::CommandHelpFormat.new( command, @app, @sorter, @synopsis_formatter_class, @text_wrapping_class ).format end end end |