-
Notifications
You must be signed in to change notification settings - Fork 15
/
reload.sh
47 lines (41 loc) · 864 Bytes
/
reload.sh
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
41
42
43
44
45
46
47
#!/bin/bash
usage()
{
echo "Usage:"
echo "./reload.sh [--disable] [--enable] [--help]"
exit
}
ENABLE="NO"
DISABLE="NO"
while [ $# -gt 0 ]
do
key="$1"
case $key in
-e|--enable)
ENABLE="YES"
;;
-d|--disable)
DISABLE="YES"
;;
-h|--help)
usage
;;
*)
echo "Unknown option"
usage
;;
esac
shift # past argument or value
done
if [[ "${DISABLE}" == "YES" ]]; then
echo "disabling reload (release)"
find . -regex ".*\.py" -exec sed -i -e 's/^importlib.reload/#importlib.reload/g' {} \;
exit
fi
if [[ "${ENABLE}" == "YES" ]]; then
echo "enabling reload (during development)"
find . -regex ".*\.py" -exec sed -i -e 's/^#importlib.reload/importlib.reload/g' {} \;
exit
fi
echo "WARNING: requires an argument"
usage