forked from Lede-Inc/LDSDKManager_IOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.sh
23 lines (21 loc) · 958 Bytes
/
format.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Change this if your clang-format executable is somewhere else
# find 'NetEasePatch' \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) ! -path '*Wax/*' ! -path '*patch/*' ! -path '*JSPatch/*' -print0
#设置需要格式化的目录,以空格隔开
INCLUDEDIR="LDSDKManager LDSDKManagerDemo LDSDKManagerTest"
#设置需要隔离的目录,以空格隔开
EXCLUDEDIR="AliSDK LDQQSDK WeChatSDK YiXinSDK libWeiboSDK"
#生成Exclude指定目录的format命令
FORMAT_EXCLUDEDIR=""
for TMPDIR in $EXCLUDEDIR
do
FORMAT_EXCLUDEDIR+=" ! -path '*"$TMPDIR"/*' "
done
echo $FORMAT_EXCLUDEDIR
#对指定文件夹执行format命令
CLANG_FORMAT="$HOME/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/bin/clang-format"
for DIRECTORY in $INCLUDEDIR
do
echo "Formatting code under $DIRECTORY/"
eval "find \"$DIRECTORY\" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) $FORMAT_EXCLUDEDIR -print0 | xargs -0 \"$CLANG_FORMAT\" -i"
done