Sha256: 201bec6498da364cff344ff16fa271d0c6cb589c37ccb33517b1f4f79e85c7c8

Contents?: true

Size: 1.04 KB

Versions: 55

Compression:

Stored size: 1.04 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

55 entries across 55 versions & 1 rubygems

Version Path
doing-2.1.88 lib/doing/help_monkey_patch.rb
doing-2.1.87 lib/doing/help_monkey_patch.rb
doing-2.1.86 lib/doing/help_monkey_patch.rb
doing-2.1.85 lib/doing/help_monkey_patch.rb
doing-2.1.84 lib/doing/help_monkey_patch.rb
doing-2.1.83 lib/doing/help_monkey_patch.rb
doing-2.1.82 lib/doing/help_monkey_patch.rb
doing-2.1.81 lib/doing/help_monkey_patch.rb
doing-2.1.80 lib/doing/help_monkey_patch.rb
doing-2.1.79 lib/doing/help_monkey_patch.rb
doing-2.1.78 lib/doing/help_monkey_patch.rb
doing-2.1.77 lib/doing/help_monkey_patch.rb
doing-2.1.76 lib/doing/help_monkey_patch.rb
doing-2.1.75 lib/doing/help_monkey_patch.rb
doing-2.1.74 lib/doing/help_monkey_patch.rb
doing-2.1.73 lib/doing/help_monkey_patch.rb
doing-2.1.72 lib/doing/help_monkey_patch.rb
doing-2.1.69 lib/doing/help_monkey_patch.rb
doing-2.1.68 lib/doing/help_monkey_patch.rb
doing-2.1.66 lib/doing/help_monkey_patch.rb