-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrune
executable file
·62 lines (52 loc) · 1.02 KB
/
rune
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
#!/bin/bash
source $PLUG_PATH/cfgs
help_msg() {
log "
rune: run everything
desc: utility to run any program as a script
supported types: .c .cpp .py .rs
help: rune <file.type>
"
}
prereqs() {
rune_set_lang $1
check_bin $RUNE_EXEC
}
rune_compile() {
$RUNE_EXEC $1 -o $RUNE_OUT
}
rune_run() {
$RUNE_OUT
}
rune_cleanup() {
rm $RUNE_OUT
}
rune_set_lang() {
case "$1" in
*.rs ) RUNE_EXEC="rustc" ;;
*.cpp ) RUNE_EXEC="g++" ;;
*.c ) RUNE_EXEC="gcc" ;;
*.py ) RUNE_EXEC="python"
rune_compile() {
:
}
rune_run() {
$RUNE_EXEC "$1"
}
rune_cleanup() {
:
}
;;
* ) err "unsupported type";;
esac
}
rune() {
rune_compile $@ || err "compilation failed"
rune_run $@ || err "run failed"
rune_cleanup || err "post-run cleanup failed"
exit 0
}
options() {
rune $1
}
init $@