Sha256: 0f5e4718e0984c24364cf63a9ee9e51c6de68c8f3264b7d9062eeb608f9ad4f3

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module GLI
  module Commands
    # Help Command Monkeypatch for paginated output
    class Help < Command
      def show_help(global_options,options,arguments,out,error)
        Doing::Pager.paginate = true

        command_finder = HelpModules::CommandFinder.new(@app,arguments,error)
        if options[:c]
          help_output = HelpModules::HelpCompletionFormat.new(@app,command_finder,arguments).format
          out.puts help_output unless help_output.nil?
        elsif arguments.empty? || options[: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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doing-2.1.26 lib/doing/help_monkey_patch.rb
doing-2.1.25 lib/doing/help_monkey_patch.rb
doing-2.1.24 lib/doing/help_monkey_patch.rb
doing-2.1.23 lib/doing/help_monkey_patch.rb