summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-10 09:31:11 -0800
committergit <svn-admin@ruby-lang.org>2022-11-10 17:31:15 +0000
commit0de3bc92b4fc3bb9fc0930e98baed37044ed44e1 (patch)
tree528b7a9b769f13a06f62b24b942cf71f79d32d14
parentbab8051d2d20a13f4aa26330a25e72ccec980f7a (diff)
downloadruby-0de3bc92b4fc3bb9fc0930e98baed37044ed44e1.tar.gz
[ruby/irb] Make $ and @ default aliases
(https://github.com/ruby/irb/pull/438) https://github.com/ruby/irb/commit/0613589476
-rw-r--r--lib/irb/init.rb5
-rw-r--r--test/irb/test_cmd.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 09099f88b7..8c9d473b74 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -159,7 +159,10 @@ module IRB # :nodoc:
@CONF[:AT_EXIT] = []
- @CONF[:COMMAND_ALIASES] = {}
+ @CONF[:COMMAND_ALIASES] = {
+ :'$' => :show_source,
+ :'@' => :whereami,
+ }
end
def IRB.set_measure_callback(type = nil, arg = nil, &block)
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index f2d8a0299b..d233cbb9b5 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -551,7 +551,6 @@ module TestIRB
def test_whereami_alias
out, err = execute_lines(
"@\n",
- conf: { COMMAND_ALIASES: { :'@' => :whereami } }
)
assert_empty err
assert_match(/^From: .+ @ line \d+ :\n/, out)
@@ -563,7 +562,6 @@ module TestIRB
out, err = execute_lines(
"@foo\n",
"$bar\n",
- conf: { COMMAND_ALIASES: { :'$' => :show_source, :'@' => :whereami } }
)
assert_empty err
assert_match(/"foo"/, out)