-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmlim.sh
More file actions
executable file
·83 lines (75 loc) · 1.64 KB
/
mlim.sh
File metadata and controls
executable file
·83 lines (75 loc) · 1.64 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
export PYTHONPATH=.
front() {
cd frontend
npm run dev
}
back() {
if ! [ -x "poetry -V" ]
then poetry run uvicorn backend.app:app --reload --port 8080
else uvicorn backend.app:app --reload --port 8080
fi
}
tests() {
python -m unittest discover
}
usage() {
echo "Usage: ./mlim.sh [ -h | --help ] [ -t | --tests ] [ -i | --lint ]
[ -b | --back ] [ -f | --front ] [ -r | --run ]
[ (-l | --lexer) TEST_FILE ]
[ (-p | --parser) TEST_FILE ]
[ (-e | --evaluation) TEST_FILE ]"
}
args=( )
for arg; do
case "${arg}" in
--help)
args+=( -h );;
--tests)
args+=( -t );;
--lint)
args+=( -i );;
--back)
args+=( -b );;
--front)
args+=( -f );;
--run)
args+=( -r );;
--lexer)
args+=( -l );;
--parser)
args+=( -p );;
--evaluation)
args+=( -e );;
*)
args+=( "$arg" );;
esac
done
eval set -- "${args[@]}"
while getopts htibfrl:p:e: OPT; do
case "${OPT}" in
h)
usage;;
t)
tests;;
i)
flake8;;
b)
back;;
f)
front;;
r)
front &
back;;
l)
python compiler/lexer.py ${OPTARG};;
p)
python compiler/parser.py ${OPTARG};;
e)
python compiler/evaluation.py ${OPTARG};;
*)
echo "Unrecognized option \"$1\""
usage
exit 2;;
esac
done