We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f54ea7a commit 294cfcbCopy full SHA for 294cfcb
1 file changed
virtualenvwrapper_bashrc
@@ -372,6 +372,13 @@ function add2virtualenv () {
372
return 1
373
fi
374
375
+ remove=0
376
+ if [ "$1" = "-d" ]
377
+ then
378
+ remove=1
379
+ shift
380
+ fi
381
+
382
if [ ! -x "$path_file" ]
383
then
384
echo "import sys; sys.__plen = len(sys.path)" >> "$path_file"
@@ -385,8 +392,14 @@ function add2virtualenv () {
385
392
386
393
echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
387
394
395
388
396
contents=$(cat "$path_file")
389
- echo "$contents" | sed "1a $absolute_path" > "$path_file"
397
+ if [ $remove -eq 1 ]
398
399
+ echo "$contents" | sed "\:^$absolute_path$: d" > "$path_file"
400
+ else
401
+ echo "$contents" | sed "1a $absolute_path" > "$path_file"
402
390
403
done
391
404
return 0
405
}
0 commit comments