forked from yodaos-project/yoda.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clang-format
executable file
·48 lines (40 loc) · 914 Bytes
/
clang-format
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
#!/usr/bin/env bash
help="
Usage:
-i Inplace edit files.
Example:
$ ./tools/clang-format -i
"
inplace='NO'
while [ $# -gt 0 ]; do
case "$1" in
-i)
inplace='YES'
;;
--help)
printf "$help"
exit
;;
-h)
printf "$help"
exit
;;
-*)
echo "Illegal option $1"
;;
esac
shift $(( $# > 0 ? 1 : 0 ))
done
cmd=`command -v clang-format-8`
if test -z "$cmd"; then
cmd=`command -v clang-format`
fi
command $cmd --version
if test $inplace = 'YES'; then
find packages client/c -iname *.h -o -iname *.cc -o -iname *.c | xargs $cmd -style=file -i
fi
rep_count=`find packages client/c -iname *.h -o -iname *.cc -o -iname *.c | xargs $cmd -style=file -output-replacements-xml | grep -c '<replacement '`
if ! test $rep_count = 0; then
find packages client/c -iname *.h -o -iname *.cc -o -iname *.c | xargs $cmd -style=file
exit 1
fi