pyenv/libexec/rbenv-which

22 lines
525 B
Bash
Executable file

#!/usr/bin/env bash -e
RBENV_VERSION="$(rbenv-version)"
RBENV_COMMAND="$1"
RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
if [ -x "$RBENV_COMMAND_PATH" ]; then
echo "$RBENV_COMMAND_PATH"
else
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
fi