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
1 changed files with 10 additions and 1 deletions

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