-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.sh
executable file
·76 lines (66 loc) · 1.27 KB
/
bot.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
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
#!/bin/sh
# function definitions
start(){
# clean the old build
rm -rf dist
# compile the ts code to js code
tsc
# run the code
node dist/index.js
}
dev(){
# clean the old build
rm -rf dist
# compile the ts code to js code
tsc
# run the code
nodemon dist/index.js
}
build(){
# clean the old build
rm -rf dist
# compile the ts code to js code
tsc
}
clean(){
# clean the old build
rm -rf dist
}
help(){
# print the possible options
echo "##[ Possible options]##:"
# start option
echo "- start:"
echo "clean the old build and rebuild the ts code to js code and run"
# dev option
echo "- dev:"
echo "run the code using nodemon"
# build option
echo "- build:"
echo "compile the ts code to js code"
# clean option
echo "- clean:"
echo "clean the javascript build"
}
default(){
# print the possible options
echo "# Possible options:"
echo "start, dev, build, clean, help"
}
# get the option from the user
opt=$1
# switch case
case $opt in
"start"|"run"|"--start"|"--run")
start
;;
"clean"|"clear"|"--clean"|"--clear")
clean
;;
"help"|"--help"|"-h")
help
;;
*)
default
;;
esac