Skip to content

Commit

Permalink
[ruby/irb] Make $ and @ default aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun authored and matzbot committed Nov 10, 2022
1 parent bab8051 commit 0de3bc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/irb/init.rb
Expand Up @@ -159,7 +159,10 @@ def IRB.init_config(ap_path)

@CONF[:AT_EXIT] = []

@CONF[:COMMAND_ALIASES] = {}
@CONF[:COMMAND_ALIASES] = {
:'$' => :show_source,
:'@' => :whereami,
}
end

def IRB.set_measure_callback(type = nil, arg = nil, &block)
Expand Down
2 changes: 0 additions & 2 deletions test/irb/test_cmd.rb
Expand Up @@ -551,7 +551,6 @@ def test_whereami
def test_whereami_alias
out, err = execute_lines(
"@\n",
conf: { COMMAND_ALIASES: { :'@' => :whereami } }
)
assert_empty err
assert_match(/^From: .+ @ line \d+ :\n/, out)
Expand All @@ -563,7 +562,6 @@ def test_vars_with_aliases
out, err = execute_lines(
"@foo\n",
"$bar\n",
conf: { COMMAND_ALIASES: { :'$' => :show_source, :'@' => :whereami } }
)
assert_empty err
assert_match(/"foo"/, out)
Expand Down

0 comments on commit 0de3bc9

Please sign in to comment.