Class: GLI::Commands::Help
- Inherits:
-
Command
- Object
- Command
- GLI::Commands::Help
- Defined in:
- lib/na/help_monkey_patch.rb
Overview
Help Command Monkeypatch for paginated output
Instance Method Summary collapse
-
#show_help(_global_options, options, arguments, out, error) ⇒ void
Show help output for GLI commands with paginated output.
Instance Method Details
#show_help(_global_options, options, arguments, out, error) ⇒ void
This method returns an undefined value.
Show help output for GLI commands with paginated output
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/na/help_monkey_patch.rb', line 24 def show_help(, , arguments, out, error) NA::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] NA::Pager.page HelpModules::GlobalHelpFormat.new(@app, @sorter, @text_wrapping_class).format else name = arguments.shift command = command_finder.find_command(name) unless command.nil? NA::Pager.page HelpModules::CommandHelpFormat.new( command, @app, @sorter, @synopsis_formatter_class, @text_wrapping_class ).format end end end |