Commit b370961 1 parent 8904652 commit b370961 Copy full SHA for b370961
File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # clang format options
4
+ method=" -i"
5
+
6
+ while getopts " in" option; do
7
+ case " ${option} " in
8
+ i) # format code
9
+ method=" -i"
10
+ ;;
11
+ n) # dry run and changes formatting warnings to errors
12
+ method=" --dry-run --Werror"
13
+ ;;
14
+ \? ) # invalid option
15
+ echo " invalid option, please use -i or -n."
16
+ exit 1
17
+ ;;
18
+ esac
19
+ done
20
+
21
+ # array of folders to format
22
+ native_path=(
23
+ " app/src/main/jni/librime_jni/*.h"
24
+ " app/src/main/jni/librime_jni/*.cc"
25
+ )
26
+
27
+ # iterate over all files in current entry
28
+ for entry in " ${native_path[@]} " ; do
29
+ clang-format --verbose ${method} -style=' file' ${entry}
30
+ if [ " $? " -ne 0 ]; then
31
+ echo " please format the code: make style-apply"
32
+ exit 1
33
+ fi
34
+ done
You can’t perform that action at this time.
0 commit comments