summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/format_source16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/format_source b/bin/format_source
index fb0264c..dea771c 100755
--- a/bin/format_source
+++ b/bin/format_source
@@ -6,6 +6,20 @@
# Note that any files or directories that are excluded here should also be
# added to the 'exclude' list in .github/workflows/clang-format-check.yml
+COMMAND="clang-format"
+
+if [ $# -eq 1 ]; then
+ COMMAND="$COMMAND-$1"
+fi
+
+echo ""
+echo "bin/format_source <version>"
+echo ""
+echo "Format the HDF5 C source using clang-format. The <version>"
+echo "parameter is optional and can be used to force a specific"
+echo "installed version of clang-format to be used."
+echo ""
+
find . \( -type d -path ./config -prune -and -not -path ./config \) \
-or \( \( \! \( \
-name H5LTanalyze.c \
@@ -19,6 +33,6 @@ find . \( -type d -path ./config -prune -and -not -path ./config \) \
-or -name H5overflow.h \
\) \) \
-and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp -or -iname *.java \) \) \
- | xargs -P0 -n1 clang-format -style=file -i -fallback-style=none
+ | xargs -P0 -n1 ${COMMAND} -style=file -i -fallback-style=none
exit 0