-
Notifications
You must be signed in to change notification settings - Fork 2
/
drc
executable file
·44 lines (36 loc) · 856 Bytes
/
drc
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
#!/bin/bash
# Run a Check django backend.
usage() {
echo "usage: ${0##*/}" 1>&2
echo "" 1>&2
echo "Run a Check django backend." 1>&2
echo "" 1>&2
echo "options:" 1>&2
echo " -h or --help shows usage help" 1>&2
exit 1
}
if echo "$*" | grep -Eq -- '--help\b|-h\b'; then
usage
fi
SRC="$(basename "$PWD")"
show() {
echo -n $'\e[38;5;40m$\e[38;5;63m '
echo -n "$@"
echo -n $'\e[0m'
echo
}
run() {
show "$@"
eval "$@"
return $?
}
django_runserver_cmd() {
run "pipenv run python manage.py runserver $1 2>&1 | jq -R -r '. as \$line | try fromjson catch \$line'"
}
if [[ $SRC == "check-api" ]]; then
django_runserver_cmd localhost:8000
elif [[ $SRC == "console" ]]; then
django_runserver_cmd localhost:8004
elif [[ $SRC == "onboard" ]]; then
django_runserver_cmd localhost:8080
fi