summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-14 15:00:46 (GMT)
committerGitHub <noreply@github.com>2023-06-14 15:00:46 (GMT)
commit61d43eb867e1cec7882a2c55c611950c63de8cf4 (patch)
treeb850ad990be86c273fdb8edb149c5d5558a03c1d /bin
parentd1ef48e70883ccdc40000eda4f33d9ec40bbb6d7 (diff)
downloadhdf5-61d43eb867e1cec7882a2c55c611950c63de8cf4.zip
hdf5-61d43eb867e1cec7882a2c55c611950c63de8cf4.tar.gz
hdf5-61d43eb867e1cec7882a2c55c611950c63de8cf4.tar.bz2
Adds an optional version arg to bin/format_source (#3119)
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