mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Add rbenv-whence to show you which versions of Ruby have a given command
This commit is contained in:
parent
652135db7f
commit
d257b562e5
1 changed files with 22 additions and 0 deletions
22
libexec/rbenv-whence
Executable file
22
libexec/rbenv-whence
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash -e
|
||||
|
||||
if [ "$1" = "--path" ]; then
|
||||
print_paths="1"
|
||||
shift
|
||||
else
|
||||
print_paths=""
|
||||
fi
|
||||
|
||||
whence() {
|
||||
local command="$1"
|
||||
rbenv-versions --bare | while read version; do
|
||||
path="$(rbenv-prefix "$version")/bin/${command}"
|
||||
if [ -x "$path" ]; then
|
||||
[ "$print_paths" ] && echo "$path" || echo "$version"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
RBENV_COMMAND="$1"
|
||||
result="$(whence "$RBENV_COMMAND")"
|
||||
[ -n "$result" ] && echo "$result"
|
Loading…
Reference in a new issue