-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·91 lines (87 loc) · 2.07 KB
/
build.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
set -e
BashDir=$(cd "$(dirname $BASH_SOURCE)" && pwd)
eval $(cat "$BashDir/script/conf.sh")
if [[ "$Command" == "" ]];then
Command="$0"
fi
function help(){
echo "build script"
echo
echo "Usage:"
echo " $0 [flags]"
echo " $0 [command]"
echo
echo "Available Commands:"
echo " help help for $0"
echo " clear clear output"
echo " go go build helper"
if [[ $View == 1 ]];then
echo " view view build helper"
fi
echo " grpc grpc protoc helper"
echo " pack pack release"
echo " run run project"
echo " docker docker build helper"
echo
echo "Flags:"
echo " -h, --help help for $0"
}
case "$1" in
help|-h|--help)
help
;;
clear)
shift
export Command="$0 clear"
"$BashDir/script/clear.sh" "$@"
;;
pack)
shift
export Command="$0 pack"
"$BashDir/script/pack.sh" "$@"
;;
go)
shift
export Command="$0 go"
"$BashDir/script/go.sh" "$@"
;;
view)
if [[ $View == 1 ]];then
shift
export Command="$0 view"
"$BashDir/script/view.sh" "$@"
else
echo Error: unknown command "$1" for "$0"
echo "Run '$0 --help' for usage."
exit 1
fi
;;
grpc)
shift
export Command="$0 grpc"
"$BashDir/script/grpc.sh" "$@"
;;
run)
shift
export Command="$0 run"
"$BashDir/script/run.sh" "$@"
;;
docker)
shift
export Command="$0 docker"
"$BashDir/script/docker.sh" "$@"
;;
*)
if [[ "$1" == "" ]];then
help
elif [[ "$1" == -* ]];then
echo Error: unknown flag "$1" for "$0"
echo "Run '$0 --help' for usage."
else
echo Error: unknown command "$1" for "$0"
echo "Run '$0 --help' for usage."
fi
exit 1
;;
esac