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:
parent
40321e1bd9
commit
dd1b2aeb1b
1 changed files with 10 additions and 1 deletions
|
@ -45,7 +45,16 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
def complete(search)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue