-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·63 lines (57 loc) · 1.49 KB
/
run.sh
File metadata and controls
executable file
·63 lines (57 loc) · 1.49 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
#!/bin/sh
scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
compile=false
run=false
all=false
while getopts ":hcrat" opt; do
case $opt in
a)
all=true
;;
h)
echo "Usage: $0 [-h] [-c r a t] language project"
exit 0
;;
c)
compile=true
;;
r)
run=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
shift $((OPTIND -1))
TIMEFORMAT='%3R'
language="${1^}"
project="${2^}"
if $all; then
for lang in $(find . -maxdepth 1 -noleaf -type d -name '[A-Z]*' -printf '%f\n' | sort); do
for proj in $scriptDir/$lang/*; do
$compile && \
echo -e -n "${lang^} $(basename $proj) Compiling..." && \
time $proj/compile.sh 2&>/dev/null
$run && \
# echo -e -n "${lang^} $(basename $proj) Running....." && \
printf "%-12s%-15sRunning....." "$lang" "$(basename $proj)" | sed 's/ /./g'
time $proj/run.sh 2&>/dev/null
done
done
else
if [[ $language == "" ]]; then
echo "Language not specified."
elif [[ $project == "" ]]; then
echo "Project not specified."
else
cd $scriptDir/$language/$project;
$compile && \
echo -e -n "${language^} ${project^} Compiling..." && \
time ./compile.sh 2&>/dev/null
$run && \
echo -e -n "${language^} ${project^} Running....." && \
time ./run.sh 2&>/dev/null
fi
fi