Update zsh completion adapter

This commit is contained in:
Sam Stephenson 2011-09-13 13:12:04 -05:00
parent 465a1472ba
commit b4f8906b24
4 changed files with 16 additions and 17 deletions

View file

@ -1,19 +1,15 @@
compctl -K _rbenv rbenv
function _rbenv_commands() {
local cmds_str="$(rbenv commands)"
reply=("${(ps:\n:)cmds_str}")
}
_rbenv_versions() {
local versions_str="$(rbenv versions --bare)"
reply=(system "${(ps:\n:)versions_str}")
}
_rbenv() {
local word words completions
read -cA words
case "$words[2]" in
set-* | global | local | shell | prefix ) _rbenv_versions ;;
* ) _rbenv_commands ;;
esac
word="${words[2]}"
if [ "${#words}" -eq 2 ]; then
completions="$(rbenv commands)"
else
completions="$(rbenv completions "${word}")"
fi
reply=("${(ps:\n:)completions}")
}

View file

@ -4,7 +4,8 @@ set -e
# Provide rbenv completions
if [ "$1" = "--complete" ]; then
echo --sh --no-sh
echo --sh
echo --no-sh
exit
fi

View file

@ -4,7 +4,8 @@ set -e
# Provide rbenv completions
if [ "$1" = "--complete" ]; then
echo system --unset
echo --unset
echo system
exec rbenv-versions --bare
fi

View file

@ -4,7 +4,8 @@ set -e
# Provide rbenv completions
if [ "$1" = "--complete" ]; then
echo system --unset
echo --unset
echo system
exec rbenv-versions --bare
fi