scripts/format-code: Pass CLANG_FORMAT via environment
Some projects define their own code formatting scripts. Instead of
requiring them to update the code formatting script each time the
version of clang-format changes, pass it via the environment so they
can use our version.
Change-Id: Ia7e8210f28024e75fa63995695bb89c401b349ad
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index b666ebe..e5a68a5 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -24,9 +24,12 @@
fi
fi
+# Allow called scripts to know which clang format we are using
+export CLANG_FORMAT="clang-format-6.0"
+
if [ -f ".clang-format" ]; then
find . -regextype sed -regex ".*\.[hc]\(pp\)\?" -not -name "*mako*" -print0 |\
- xargs -0 "clang-format-6.0" -i
+ xargs -0 "${CLANG_FORMAT}" -i
git --no-pager diff --exit-code
fi