oggy / looksee

Supercharged method introspection in IRB
MIT License
364 stars 14 forks source link

require-ing in irbrc shows warning "can't alias ls from irb_ls" #56

Closed stefanwascoding closed 2 years ago

stefanwascoding commented 3 years ago

When one requires this gem in the irbrc file, you get a warning on irb startup, from ruby 2.7 onwards (tested in 2.7.1 and 3.0.0):

% irb -f -r'looksee'
irb: warn: can't alias ls from irb_ls.
irb(main):001:0>

If you require the gem after irb has finished loading, there is no issue.

% irb -f
irb(main):001:0> require 'looksee'
=> true
irb(main):002:0>

Main difference seems to be the result of show_source 'ls' (in REPL). For the startup (and command line) case it shows Looksee, otherwise irb/extend-command.rb.

Warning goes away if one adds Looksee.rename :_ls to irbrc ... but considering this happens for a straightforward installation, it seems like that should not be necessary. Would be great if require-ing looksee in irbrc and during REPL would behave the same way.

Probably relevant:

zw963 commented 2 years ago

I can reproduce this issue too on ruby 3.1.2, and Looksee.rename :_ls hacks works for me.