aboutsummaryrefslogtreecommitdiff
path: root/venvworkon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'venvworkon.sh')
-rwxr-xr-xvenvworkon.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/venvworkon.sh b/venvworkon.sh
new file mode 100755
index 0000000..1da01bd
--- /dev/null
+++ b/venvworkon.sh
@@ -0,0 +1,30 @@
+workon() {
+ envroot="$HOME/.venv"
+
+ if [ ! -e "$envroot" ]
+ then
+ mkdir -p "$envroot"
+ fi
+
+ if [ "$#" -lt "1" ]
+ then
+ ls "$envroot"
+ return
+ fi
+
+ envname=$1
+
+ envdir="$envroot/$envname"
+
+ if [ ! -e "$envdir" ]
+ then
+ pyvenv "$envdir"
+ fi
+
+ source "$envdir/bin/activate"
+
+ if [ -e "$envdir/postload.sh" ]
+ then
+ source "$envdir/postload.sh"
+ fi
+}