forked from BalestraPatrick/ClangFormatter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·48 lines (34 loc) · 902 Bytes
/
install
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
#!/bin/sh
set -ue
APP_ZIP_FILE="lastest-version.gz"
APP_LASTEST_DOWNLOAD_URL="https://github.com/poplax/ClangFormatter/releases/download/v1.0.0/${APP_ZIP_FILE}"
APP_TMP_DIR="code_style_tmp"
APP_FILENAME="ClangFormatter.app"
RED="\033[0;31m"
GREEN="\033[0;32m"
curl -o $APP_ZIP_FILE -LSk $APP_LASTEST_DOWNLOAD_URL
echo "$APP_LASTEST_DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo $RED"Failed."
exit 0
fi
if [ ! -d $APP_TMP_DIR ]; then
mkdir $APP_TMP_DIR
fi
tar -xzf $APP_ZIP_FILE -C $APP_TMP_DIR
# Install app
cd $APP_TMP_DIR
cp -rf "$APP_FILENAME" "/Applications/"
open "/Applications/$APP_FILENAME"
if [ $? -eq 0 ]; then
osascript -e 'quit app "ClangFormatter"'
fi
# Message.
echo ""
if [ $? -eq 0 ]; then
echo $GREEN"***** Install Success."
echo "Follow the step:"
echo "System Preferences -> Extensions -> Xocde Source Editor -> ClangFormat"
else
echo $GREEN"* Install Failed."
fi