mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Update zsh completion adapter
This commit is contained in:
parent
465a1472ba
commit
b4f8906b24
4 changed files with 16 additions and 17 deletions
|
@ -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}")
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ set -e
|
|||
|
||||
# Provide rbenv completions
|
||||
if [ "$1" = "--complete" ]; then
|
||||
echo --sh --no-sh
|
||||
echo --sh
|
||||
echo --no-sh
|
||||
exit
|
||||
fi
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue