403Webshell
Server IP : 217.160.0.244  /  Your IP : 216.73.216.36
Web Server : Apache
System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64
User : u100174116 ( 6746176)
PHP Version : 8.5.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/ruby/3.3.0/irb/command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/ruby/3.3.0/irb/command/history.rb
# frozen_string_literal: true

require "stringio"

require_relative "../pager"

module IRB
  # :stopdoc:

  module Command
    class History < Base
      category "IRB"
      description "Shows the input history. `-g [query]` or `-G [query]` allows you to filter the output."

      def execute(arg)

        if (match = arg&.match(/(-g|-G)\s+(?<grep>.+)\s*\n\z/))
          grep = Regexp.new(match[:grep])
        end

        formatted_inputs = irb_context.io.class::HISTORY.each_with_index.reverse_each.filter_map do |input, index|
          next if grep && !input.match?(grep)

          header = "#{index}: "

          first_line, *other_lines = input.split("\n")
          first_line = "#{header}#{first_line}"

          truncated_lines = other_lines.slice!(1..) # Show 1 additional line (2 total)
          other_lines << "..." if truncated_lines&.any?

          other_lines.map! do |line|
            " " * header.length + line
          end

          [first_line, *other_lines].join("\n") + "\n"
        end

        Pager.page_content(formatted_inputs.join)
      end
    end
  end

  # :startdoc:
end

Youez - 2016 - github.com/yon3zu
LinuXploit