File tree Expand file tree Collapse file tree 2 files changed +27
-17
lines changed Expand file tree Collapse file tree 2 files changed +27
-17
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- #! /usr/bin/env bash
2
- which deactivate
3
- rv=$?
4
- if [ $rv -eq 0 ]; then
5
- echo " venv already sourced"
1
+ #! /bin/sh
2
+ function usage() {
3
+ echo " Usage: ./run.sh [virtual-env-directory]"
4
+ echo
5
+ }
6
+ function error() {
7
+ echo " Something went wrong when sourcing the venv. Please check your venv directory and ensure j2dx is installed correctly."
8
+ usage
9
+ exit 1
10
+ }
11
+
12
+ type -t j2dx > /dev/null 2>&1
13
+ if [ $? -eq 0 ]; then
14
+ echo " j2dx found! running instance"
6
15
else
7
- source ../bin/activate
16
+ if [ " $# " -eq 1 ]; then
17
+ source $1 /bin/activate || error
18
+
19
+ type -t j2dx > /dev/null 2>&1 || error
20
+
21
+ elif [ " $# " -eq 0 ]; then
22
+ echo " Sourcing default directory from ../bin/activate"
23
+ source ../bin/activate
24
+ else
25
+ usage
26
+ exit 1
27
+ fi
8
28
fi
9
29
10
- j2dx & python3 -m http.server && kill $! && deactivate
30
+ j2dx & python3 -m http.server && kill $!
You can’t perform that action at this time.
0 commit comments