mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
22 lines
434 B
Bash
Executable file
22 lines
434 B
Bash
Executable file
#!/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"
|