mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-23 06:01:21 +00:00
23 lines
434 B
Text
23 lines
434 B
Text
|
#!/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"
|