mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00

(https://github.com/ruby/irb/pull/901)
* Always save irb_history in HOME or XDG_CONFIG_HOME
Also split irbrc search logic from irb_history search logic as a refactor
* Remove IRB.conf[:RC_NAME_GENERATOR] because it's not configurable
This conf is used to specify which irbrc to load. Need to configure before irbrc is loaded, so it's actually not configurable.
This conf is also used for history file search, but it is configurable by conf[:HISTORY_FILE].
* remove rc_file_test because it is tested with rc_files, remove useless test setup
* Make internal irbrc searching method private
11d03a6ff7
33 lines
1.1 KiB
Ruby
33 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module IRB
|
|
# :stopdoc:
|
|
|
|
module Command
|
|
class IrbInfo < Base
|
|
category "IRB"
|
|
description "Show information about IRB."
|
|
|
|
def execute
|
|
str = "Ruby version: #{RUBY_VERSION}\n"
|
|
str += "IRB version: #{IRB.version}\n"
|
|
str += "InputMethod: #{IRB.CurrentContext.io.inspect}\n"
|
|
str += "Completion: #{IRB.CurrentContext.io.respond_to?(:completion_info) ? IRB.CurrentContext.io.completion_info : 'off'}\n"
|
|
rc_files = IRB.irbrc_files
|
|
str += ".irbrc paths: #{rc_files.join(", ")}\n" if rc_files.any?
|
|
str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n"
|
|
str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty?
|
|
str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty?
|
|
str += "East Asian Ambiguous Width: #{Reline.ambiguous_width.inspect}\n"
|
|
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
|
codepage = `chcp`.b.sub(/.*: (\d+)\n/, '\1')
|
|
str += "Code page: #{codepage}\n"
|
|
end
|
|
puts str
|
|
nil
|
|
end
|
|
end
|
|
end
|
|
|
|
# :startdoc:
|
|
end
|