diff options
| author | Joshua Peek <josh@joshpeek.com> | 2012-07-23 15:52:49 -0500 |
|---|---|---|
| committer | Joshua Peek <josh@joshpeek.com> | 2012-07-23 15:52:49 -0500 |
| commit | 7b6caa0f6c7603aabb5e6ed657e24aaddbeafc78 (patch) | |
| tree | ec0522eae75bb04ae73d28ae3f599682a2bfdaeb /samples/Shell/rbenv-sh-shell | |
| parent | 314f0e485227915931db361be14d308a210bedea (diff) | |
Rename samples subdirectories
Diffstat (limited to 'samples/Shell/rbenv-sh-shell')
| -rwxr-xr-x | samples/Shell/rbenv-sh-shell | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/samples/Shell/rbenv-sh-shell b/samples/Shell/rbenv-sh-shell new file mode 100755 index 0000000..a216cb2 --- /dev/null +++ b/samples/Shell/rbenv-sh-shell @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -e +[ -n "$RBENV_DEBUG" ] && set -x + +# Provide rbenv completions +if [ "$1" = "--complete" ]; then + echo --unset + echo system + exec rbenv-versions --bare +fi + +version="$1" + +if [ -z "$version" ]; then + if [ -z "$RBENV_VERSION" ]; then + echo "rbenv: no shell-specific version configured" >&2 + exit 1 + else + echo "echo \"\$RBENV_VERSION\"" + exit + fi +fi + +if [ "$version" = "--unset" ]; then + echo "unset RBENV_VERSION" + exit 1 +fi + +# Make sure the specified version is installed. +rbenv-prefix "$version" >/dev/null + +echo "export RBENV_VERSION=\"${version}\"" |
