File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22# 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+
38
49# Variable that will hold the name of the clang-format command
510FMT=" "
@@ -20,6 +25,11 @@ if [ -z "$FMT" ]; then
2025 exit 1
2126fi
2227
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
2435
25- ${FMT} -i ${files}
You can’t perform that action at this time.
0 commit comments