Skip to content

Commit c2c8138

Browse files
committed
Better help and error messages for build script
1 parent 3ac2ecb commit c2c8138

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

build.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
#!/bin/bash
22

3+
set -e
4+
35
if [[ "$1" == "--help" ]] || [[ "$1" == "help" ]] || [[ "$1" == "-h" ]]; then
4-
echo "Avaliable Options: [chromium],[firefox],[chromiumtest],[chromiumtestremove]"
5-
fi
6-
if [[ "$1" == "chromium" ]]; then
6+
echo -e "Build script for SAS Powerschool Enhancement Suite\n\n Usage: ./build.sh OPTION\n\nOptions:\n firefox Build packaged version for Firefox\n chromium Build packaged version for Chromium\n chromiumtest Create folder to load unpackaged into Chromium\n chromiumtestremove Remove folder made by './build.sh chromiumtest' command\n\n SAS Powerschool Enhancement Suite is licensed under GPL-3.0."
7+
8+
elif [[ "$1" == "chromium" ]]; then
79
mkdir tmp
810
cp ./src/{chromium,css,icons,js,lib,ui,'manifest - chromium.json'} ./tmp -r
911
mv "./tmp/manifest - chromium.json" "./tmp/manifest.json"
1012
cd tmp
1113
zip -r9 ../chromium_build.zip ./
1214
cd ..
1315
rm -r ./tmp
14-
echo Chromium build complete. Saved as chromium_build.zip
15-
fi
16-
if [[ "$1" == "firefox" ]]; then
16+
echo -e "Chromium build complete. Saved as chromium_build.zip"
17+
18+
elif [[ "$1" == "firefox" ]]; then
1719
mkdir tmp
1820
cp ./src/{css,icons,js,lib,ui,manifest.json} ./tmp -r
1921
cd tmp
2022
zip -r9 ../firefox_build.zip ./
2123
cd ..
2224
rm -r ./tmp
23-
echo Firefox build complete. Saved as firefox_build.zip
24-
fi
25-
if [[ "$1" == "chromiumtest" ]]; then
25+
echo -e "Firefox build complete. Saved as firefox_build.zip"
26+
27+
elif [[ "$1" == "chromiumtest" ]]; then
2628
mkdir chromiumtest
2729
cp ./src/{chromium,css,icons,js,lib,ui,'manifest - chromium.json'} ./chromiumtest -r
2830
mv "./chromiumtest/manifest - chromium.json" "./chromiumtest/manifest.json"
29-
echo Chromium test folder made
30-
fi
31-
if [[ "$1" == "chromiumtestremove" ]]; then
32-
rm -r ./chromiumtest
33-
echo Chromium test folder removed
34-
fi
31+
echo -e "Chromium test folder made"
3532

33+
elif [[ "$1" == "chromiumtestremove" ]]; then
34+
rm -r ./chromiumtest
35+
echo -e "Chromium test folder removed"
36+
else
37+
echo -e "Usage: ./build.sh OPTION\nTry './build.sh --help' for more information."
38+
fi

0 commit comments

Comments
 (0)