File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [ -z " $ENVS_DIR " ]; then
4
+ ENVS_DIR=~ /.envs
5
+ fi
6
+
7
+ aenv_run () {
8
+ defIFS=$IFS
9
+ activate=bin/activate
10
+ envDir=.env
11
+ found=false
12
+
13
+ while IFS=: read envName projectRoot local
14
+ do
15
+ if [[ " $PWD " = " $projectRoot " * ]]; then
16
+
17
+ if [[ -n $local ]]; then
18
+ actFile=$projectRoot /$envDir /$activate
19
+
20
+ if [[ -e $actFile ]]; then
21
+ found=true
22
+ source $actFile
23
+ else
24
+ echo " Couldn't find $actFile "
25
+ fi
26
+ else
27
+ found=true
28
+ source " $ENVS_DIR /$envName /$activate "
29
+ fi
30
+ fi
31
+
32
+ done < ~ /.aenv/aenv.conf
33
+
34
+ if ! $found && [[ -n " $VIRTUAL_ENV " ]]; then
35
+ deactivate
36
+ fi
37
+
38
+ IFS=$defIFS
39
+ }
40
+
41
+ aenv_cd ()
42
+ {
43
+ if builtin cd " $@ "
44
+ then
45
+ aenv_run
46
+ return 0
47
+ else
48
+ return $?
49
+ fi
50
+ }
51
+
52
+ cd () {
53
+ aenv_cd " $@ "
54
+ }
55
+
56
+ cd .
You can’t perform that action at this time.
0 commit comments