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 023c918 commit 440ae55Copy full SHA for 440ae55
pyenvcmd
@@ -0,0 +1,28 @@
1
+#!/bin/bash
2
+
3
+# This commands lists your python virtualenvs, activate the selected one and runs an command on it
4
5
+env="${PYENV_ROOT:?Please set your PYENV_ROOT env variable before running $0}"
6
7
+cd "$env/versions"
8
9
+# TODO: refac this to handle possible spaces in virtualenv names
10
+envs=(`find . -maxdepth 1 -type l -exec basename {} \;`)
11
12
+for i in "${!envs[@]}"; do
13
+ printf "%s\t%s\n" "$i" "${envs[$i]}"
14
+done
15
16
+read -r -p "Environment id:" choose
17
18
+env="${envs[$choose]}"
19
20
+cd - >> /dev/null
21
22
+printf "(%s)" "$env"
23
24
+pyenv activate $env
25
26
+$*
27
28
+pyenv deactivate
0 commit comments