We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c876bab commit 23dc231Copy full SHA for 23dc231
1 file changed
scripts/fmt.sh
@@ -1,5 +1,10 @@
1
#!/bin/bash
2
# Used to format files to the given format using clang format.
3
+# example runs:
4
+# ./scripts/fmt.sh
5
+# ./scripts/fmt.sh format # This will write changes to file
6
+APPLY_FORMAT=${1:-""}
7
+
8
9
# Variable that will hold the name of the clang-format command
10
FMT=""
@@ -20,6 +25,11 @@ if [ -z "$FMT" ]; then
20
25
exit 1
21
26
fi
22
27
23
-files=$(find . \( -path ./build -prune -o -path ./.git -prune \) -o -type f -name "*[h|c]pp" -print)
28
+files=$(find . \( -path ./build -prune -o -path ./.git -prune -o -path ./third_party -prune \) -o -type f -name "*[h|c]pp" -print)
29
30
+if [[ ${APPLY_FORMAT} = "format" ]]; then
31
+ ${FMT} -i ${files}
32
+else
33
+ ${FMT} --dry-run --Werror ${files}
34
+fi
24
35
-${FMT} -i ${files}
0 commit comments