Skip to content

Commit 75eb54c

Browse files
committed
add zsh completion support, courtesy of Ted Leung
--HG-- extra : convert_revision : svn%3A98f53aa3-d424-0410-b225-a548b0275c4d/Projects/virtualenvwrapper/trunk%401850
1 parent f663a81 commit 75eb54c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

virtualenvwrapper_bashrc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,19 @@ function workon () {
146146
# Set up tab completion. (Adapted from Arthur Koziel's version at
147147
# http://arthurkoziel.com/2008/10/11/virtualenvwrapper-bash-completion/)
148148
#
149-
_virtualenvs ()
150-
{
151-
local cur="${COMP_WORDS[COMP_CWORD]}"
152-
COMPREPLY=( $(compgen -W "`show_workon_options`" -- ${cur}) )
153-
}
154149

155-
complete -o default -o nospace -F _virtualenvs workon
156-
complete -o default -o nospace -F _virtualenvs rmvirtualenv
150+
if [ -n "$BASH" ] ; then
151+
_virtualenvs ()
152+
{
153+
local cur="${COMP_WORDS[COMP_CWORD]}"
154+
COMPREPLY=( $(compgen -W "`show_workon_options`" -- ${cur}) )
155+
}
156+
157+
complete -o default -o nospace -F _virtualenvs workon
158+
complete -o default -o nospace -F _virtualenvs rmvirtualenv
159+
elif [ -n "$ZSH_VERSION" ] ; then
160+
compctl -g "`show_workon_options`" workon rmvirtualenv
161+
fi
157162

158163
# Path management for packages outside of the virtual env.
159164
# Based on a contribution from James Bennett and Jannis Leidel.

0 commit comments

Comments
 (0)