pyenv/libexec/rbenv-commands

33 lines
570 B
Text
Raw Normal View History

#!/usr/bin/env bash
set -e
2011-08-03 23:20:01 -04:00
2011-08-23 12:34:03 -04:00
if [ "$1" = "--sh" ]; then
sh=1
shift
fi
2011-09-06 23:07:05 -04:00
if [ "$1" = "--no-sh" ]; then
nosh=1
shift
fi
2011-08-03 23:20:01 -04:00
shopt -s nullglob
{ for path in ${PATH//:/$'\n'}; do
for command in "${path}/rbenv-"*; do
2011-08-23 12:34:03 -04:00
command="${command##*rbenv-}"
if [ -n "$sh" ]; then
if [ ${command:0:3} = "sh-" ]; then
echo ${command##sh-}
fi
2011-09-06 23:07:05 -04:00
elif [ -n "$nosh" ]; then
2011-08-23 12:34:03 -04:00
if [ ${command:0:3} != "sh-" ]; then
2011-09-06 23:07:05 -04:00
echo ${command##sh-}
2011-08-23 12:34:03 -04:00
fi
2011-09-06 23:07:05 -04:00
else
echo ${command##sh-}
2011-08-23 12:34:03 -04:00
fi
2011-08-03 23:20:01 -04:00
done
done
} | sort | uniq