Show which versions of Ruby have a command installed when rbenv-which fails

This commit is contained in:
Sam Stephenson 2011-08-02 23:53:23 -05:00
parent d257b562e5
commit a62bd23ba2

View file

@ -7,6 +7,16 @@ RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND
if [ -x "$RBENV_COMMAND_PATH" ]; then if [ -x "$RBENV_COMMAND_PATH" ]; then
echo "$RBENV_COMMAND_PATH" echo "$RBENV_COMMAND_PATH"
else else
echo "rbenv: $1: command not found" >&2 echo "rbenv: $RBENV_COMMAND: command not found" >&2
versions="$(rbenv-whence "$RBENV_COMMAND" || true)"
if [ -n "$versions" ]; then
{ echo
echo "The \`$1' command exists in these Ruby versions:"
echo "$versions" | sed 's/^/ /g'
echo
} >&2
fi
exit 127 exit 127
fi fi