From a62bd23ba2c66f296ea4fc344dfc41486d290e1c Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Tue, 2 Aug 2011 23:53:23 -0500 Subject: [PATCH] Show which versions of Ruby have a command installed when rbenv-which fails --- libexec/rbenv-which | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libexec/rbenv-which b/libexec/rbenv-which index 0e05c81b..7f308e2d 100755 --- a/libexec/rbenv-which +++ b/libexec/rbenv-which @@ -7,6 +7,16 @@ RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND if [ -x "$RBENV_COMMAND_PATH" ]; then echo "$RBENV_COMMAND_PATH" 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 fi