@@ -36,7 +36,7 @@ export WORKON_HOME
36
36
function virtualenvwrapper_verify_workon_home () {
37
37
if [ ! -d "$WORKON_HOME" ]
38
38
then
39
- echo "ERROR: Virtual environments directory '$WORKON_HOME' does not exist."
39
+ echo "ERROR: Virtual environments directory '$WORKON_HOME' does not exist." >&2
40
40
return 1
41
41
fi
42
42
return 0
@@ -47,7 +47,7 @@ function virtualenvwrapper_verify_workon_environment () {
47
47
typeset env_name="$1"
48
48
if [ ! -d "$WORKON_HOME/$env_name" ]
49
49
then
50
- echo "ERROR: Environment '$env_name' does not exist. Create it with 'mkvirtualenv $env_name'."
50
+ echo "ERROR: Environment '$env_name' does not exist. Create it with 'mkvirtualenv $env_name'." >&2
51
51
return 1
52
52
fi
53
53
return 0
@@ -57,7 +57,7 @@ function virtualenvwrapper_verify_workon_environment () {
57
57
function virtualenvwrapper_verify_active_environment () {
58
58
if [ ! -n "${VIRTUAL_ENV}" ] || [ ! -d "${VIRTUAL_ENV}" ]
59
59
then
60
- echo "ERROR: no virtualenv active, or active virtualenv is missing"
60
+ echo "ERROR: no virtualenv active, or active virtualenv is missing" >&2
61
61
return 1
62
62
fi
63
63
return 0
@@ -106,14 +106,14 @@ function rmvirtualenv () {
106
106
virtualenvwrapper_verify_workon_home || return 1
107
107
if [ "$env_name" = "" ]
108
108
then
109
- echo "Please specify an enviroment."
109
+ echo "Please specify an enviroment." >&2
110
110
return 1
111
111
fi
112
112
env_dir="$WORKON_HOME/$env_name"
113
113
if [ "$VIRTUAL_ENV" = "$env_dir" ]
114
114
then
115
- echo "ERROR: You cannot remove the active environment ('$env_name')."
116
- echo "Either switch to another environment, or run 'deactivate'."
115
+ echo "ERROR: You cannot remove the active environment ('$env_name')." >&2
116
+ echo "Either switch to another environment, or run 'deactivate'." >&2
117
117
return 1
118
118
fi
119
119
virtualenvwrapper_run_hook "$WORKON_HOME/prermvirtualenv" "$env_dir"
@@ -149,7 +149,7 @@ function workon () {
149
149
activate="$WORKON_HOME/$env_name/bin/activate"
150
150
if [ ! -f "$activate" ]
151
151
then
152
- echo "ERROR: Environment '$WORKON_HOME/$env_name' does not contain an activate script."
152
+ echo "ERROR: Environment '$WORKON_HOME/$env_name' does not contain an activate script." >&2
153
153
return 1
154
154
fi
155
155
@@ -206,6 +206,13 @@ if [ -n "$BASH" ] ; then
206
206
COMPREPLY=( $(compgen -W "`virtualenvwrapper_show_workon_options`" -- ${cur}) )
207
207
}
208
208
209
+ _cdvirtualenv_complete ()
210
+ {
211
+ local cur="$2"
212
+ # COMPREPLY=( $(compgen -d -- "${VIRTUAL_ENV}/${cur}" | sed -e "s@${VIRTUAL_ENV}/@@" ) )
213
+ COMPREPLY=( $(cdvirtualenv && compgen -d -- "${cur}" ) )
214
+ }
215
+ complete -o nospace -F _cdvirtualenv_complete -S/ cdvirtualenv
209
216
complete -o default -o nospace -F _virtualenvs workon
210
217
complete -o default -o nospace -F _virtualenvs rmvirtualenv
211
218
elif [ -n "$ZSH_VERSION" ] ; then
@@ -233,7 +240,7 @@ function add2virtualenv () {
233
240
234
241
if [ ! -d "${site_packages}" ]
235
242
then
236
- echo "ERROR: currently-active virtualenv does not appear to have a site-packages directory"
243
+ echo "ERROR: currently-active virtualenv does not appear to have a site-packages directory" >&2
237
244
return 1
238
245
fi
239
246
0 commit comments