-
Notifications
You must be signed in to change notification settings - Fork 2
/
BuildSamm.sh
51 lines (43 loc) · 1.48 KB
/
BuildSamm.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
#!/bin/bash
#Flags
configuration="Debug"
execute=false
build=false
pull=false
path="$HOME/Projects/SammBot"
#Script name.
script_name="$(basename $0)"
function print_usage()
{
echo "Usage: ${script_name} [-c BUILD_CONFIG] [-e] [-b] [-r] [-p BOT_PATH] [-h]"
echo " -c BUILD_CONFIG : Sets the target config for dotnet. For example, Debug or Release. Default value is Debug."
echo " -e : Add this flag to tell the script to execute the bot."
echo " -b : Add this flag to tell the script to build the bot."
echo " -r : Add this flag to tell the script to pull from the git repository."
echo " -p BOT_PATH : Sets the path where the bot is located. Default is $HOME/Projects/SammBot."
echo " -h : Prints this usage text and exits."
}
while getopts "c:ebrp:h" flag
do
case "${flag}" in
c) configuration=${OPTARG};;
e) execute=true;;
b) build=true;;
r) pull=true;;
p) path=${OPTARG};;
h) print_usage; exit;;
esac
done
cd $path
if [ "$pull" = true ] ; then
echo "Pulling from git..."
git pull
fi
if [ "$build" = true ] ; then
echo "Attempting to build Samm-Bot on \"${configuration}\" configuration."
dotnet build --configuration $configuration
fi
if [ "$execute" = true ] ; then
cd ./Source/bin/$configuration/net8.0
./SammBot.Bot
fi