[ruby/irb] Make $ and @ default aliases

(https://github.com/ruby/irb/pull/438)

https://github.com/ruby/irb/commit/0613589476
This commit is contained in:
Takashi Kokubun 2022-11-10 09:31:11 -08:00 committed by git
parent bab8051d2d
commit 0de3bc92b4
2 changed files with 4 additions and 3 deletions

View File

@ -159,7 +159,10 @@ module IRB # :nodoc:
@CONF[:AT_EXIT] = [] @CONF[:AT_EXIT] = []
@CONF[:COMMAND_ALIASES] = {} @CONF[:COMMAND_ALIASES] = {
:'$' => :show_source,
:'@' => :whereami,
}
end end
def IRB.set_measure_callback(type = nil, arg = nil, &block) def IRB.set_measure_callback(type = nil, arg = nil, &block)

View File

@ -551,7 +551,6 @@ module TestIRB
def test_whereami_alias def test_whereami_alias
out, err = execute_lines( out, err = execute_lines(
"@\n", "@\n",
conf: { COMMAND_ALIASES: { :'@' => :whereami } }
) )
assert_empty err assert_empty err
assert_match(/^From: .+ @ line \d+ :\n/, out) assert_match(/^From: .+ @ line \d+ :\n/, out)
@ -563,7 +562,6 @@ module TestIRB
out, err = execute_lines( out, err = execute_lines(
"@foo\n", "@foo\n",
"$bar\n", "$bar\n",
conf: { COMMAND_ALIASES: { :'$' => :show_source, :'@' => :whereami } }
) )
assert_empty err assert_empty err
assert_match(/"foo"/, out) assert_match(/"foo"/, out)