-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.postactivate
More file actions
40 lines (32 loc) · 885 Bytes
/
base.postactivate
File metadata and controls
40 lines (32 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# Copyright (c) 2015-2017 Matthew Pearson <matthewpearson@gmail.com>.
#
# These scripts are free. There is no warranty; your mileage may vary.
# Visit http://creativecommons.org/licenses/by-nc-sa/4.0/ for more details.
#
# sh-compatible commands sourced after every virtualenv is activated
#
# shellcheck disable=SC2006 # $() doesn't work in old Bourne shells
#
[ "$VIRTUAL_ENV" ] || return
if [ ! "$_ORIGINAL_PS1" ]
then
_ORIGINAL_PS1="$PS1"
export _ORIGINAL_PS1
fi
if [ ! "$_ORIGINAL_PS1_FIRST" ]
then
_ORIGINAL_PS1_FIRST="$PS1_FIRST"
export _ORIGINAL_PS1_FIRST
fi
if [ ! "$_ORIGINAL_PS1_SECOND" ]
then
_ORIGINAL_PS1_SECOND="$PS1_SECOND"
export _ORIGINAL_PS1_SECOND
fi
venvnam="`basename \"$VIRTUAL_ENV\"`"
PS1_SECOND="[$venvnam] $_ORIGINAL_PS1_SECOND"
echo " (updated prompt to reflect $VIRTUAL_ENV virtual environment)" >&2
unset venvnam
#EOF __TAGGED__