diff --git a/libexec/rbenv-exec b/libexec/rbenv-exec index d53065fa..ac060196 100755 --- a/libexec/rbenv-exec +++ b/libexec/rbenv-exec @@ -4,10 +4,7 @@ set -e # Provide rbenv completions if [ "$1" = "--complete" ]; then - for command in "${RBENV_ROOT}/shims/"*; do - echo "${command##*/}" - done - exit + exec rbenv shims --short fi RBENV_COMMAND="$1" diff --git a/libexec/rbenv-shims b/libexec/rbenv-shims new file mode 100755 index 00000000..6691e60d --- /dev/null +++ b/libexec/rbenv-shims @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e +[ -n "$RBENV_DEBUG" ] && set -x + +# Provide rbenv completions +if [ "$1" = "--complete" ]; then + echo --short + exit +fi + +for command in "${RBENV_ROOT}/shims/"*; do + if [ "$1" = "--short" ]; then + echo "${command##*/}" + else + echo "$command" + fi +done | sort