1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

lib/pry/commands/cat.rb: add TAB-completion for $LOAD_PATH (fixes #1020)

Note that we want to skip over directories.
This commit is contained in:
Kyrylo Silin 2013-11-27 01:17:03 +02:00
parent 40321e1bd9
commit dd1b2aeb1b

View file

@ -45,7 +45,16 @@ class Pry
end
def complete(search)
super + Bond::Rc.files(search.split(" ").last || '')
super | Bond::Rc.files(search.split(' ').last || '') | load_path_completions
end
def load_path_completions
$LOAD_PATH.flat_map do |path|
Dir[path + '/**/*'].map { |f|
next if File.directory?(f)
f.sub(path + '/', '')
}
end
end
end