File tree Expand file tree Collapse file tree 5 files changed +66
-8
lines changed Expand file tree Collapse file tree 5 files changed +66
-8
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,26 @@ new environment is automatically activated after being initialized.
45
45
* :ref: `scripts-premkvirtualenv `
46
46
* :ref: `scripts-postmkvirtualenv `
47
47
48
+ .. _command-lsvirtualenv :
49
+
50
+ lsvirtualenv
51
+ ------------
52
+
53
+ List all of the environments.
54
+
55
+ Syntax::
56
+
57
+ lsvirtualenv [-l] [-h]
58
+
59
+ -l
60
+ Long mode, enables verbose output.
61
+ -h
62
+ Print the help for lsvirtualenv.
63
+
64
+ .. seealso ::
65
+
66
+ * :ref: `scripts-get_env_details `
67
+
48
68
rmvirtualenv
49
69
------------
50
70
Original file line number Diff line number Diff line change 2
2
Release History
3
3
===============
4
4
5
+ 2.4
6
+
7
+ - Add ``lsvirtualenv `` command with ``-l `` option to run
8
+ ``get_env_details `` hook instead of always running it when
9
+ ``workon `` has no arguments.
10
+
5
11
2.3
6
12
7
13
- Added ``get_env_details `` hook.
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
3
3
PROJECT = 'virtualenvwrapper'
4
- VERSION = '2.3 '
4
+ VERSION = '2.4 '
5
5
6
6
# Bootstrap installation of Distribute
7
7
import distribute_setup
Original file line number Diff line number Diff line change @@ -240,20 +240,52 @@ virtualenvwrapper_show_workon_options () {
240
240
# (cd "$WORKON_HOME"; find -L . -depth 3 -path '*/bin/activate') | sed 's|^\./||' | sed 's|/bin/activate||' | sort
241
241
}
242
242
243
- # List or change working virtual environments
244
- #
245
- # Usage: workon [environment_name]
243
+ _lsvirtualenv_usage () {
244
+ echo " lsvirtualenv [-lh]"
245
+ }
246
+
247
+ # List virtual environments
246
248
#
247
- workon () {
248
- typeset env_name=" $1 "
249
- if [ " $env_name " = " " ]
249
+ # Usage: lsvirtualenv [-l]
250
+ lsvirtualenv () {
251
+ typeset args=$( getopt lh $* )
252
+ if [ $? != 0 ]
253
+ then
254
+ _lsvirtualenv_usage
255
+ return 1
256
+ fi
257
+ typeset long_mode=false
258
+ for opt in $args
259
+ do
260
+ case " $opt " in
261
+ -l) long_mode=true;;
262
+ -h) _lsvirtualenv_usage;
263
+ return 1;;
264
+ esac
265
+ done
266
+
267
+ if $long_mode
250
268
then
251
269
for env_name in $( virtualenvwrapper_show_workon_options)
252
270
do
253
271
echo -n " $env_name "
254
272
virtualenvwrapper_run_hook " get_env_details" " $env_name "
255
273
echo
256
274
done
275
+ else
276
+ virtualenvwrapper_show_workon_options
277
+ fi
278
+ }
279
+
280
+ # List or change working virtual environments
281
+ #
282
+ # Usage: workon [environment_name]
283
+ #
284
+ workon () {
285
+ typeset env_name=" $1 "
286
+ if [ " $env_name " = " " ]
287
+ then
288
+ lsvirtualenv
257
289
return 1
258
290
fi
259
291
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def run_global(script_name, *args):
95
95
96
96
# get_env_details
97
97
("get_env_details" ,
98
- "This hook is run when the list of virtualenvs is printed so each name can include details." ),
98
+ "This hook is run when the list of virtualenvs is printed in 'long' mode so each name can include details." ),
99
99
]
100
100
101
101
You can’t perform that action at this time.
0 commit comments