From 61830048d5b0e4d064d2186a103c9da692ad1d07 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Tue, 13 Sep 2011 12:55:19 -0500 Subject: [PATCH] Extract rbenv-shims --- libexec/rbenv-exec | 5 +---- libexec/rbenv-shims | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 libexec/rbenv-shims 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