From 61d43eb867e1cec7882a2c55c611950c63de8cf4 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Jun 2023 08:00:46 -0700 Subject: [PATCH] Adds an optional version arg to bin/format_source (#3119) --- bin/format_source | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/format_source b/bin/format_source index fb0264cc3c6..dea771ce7f4 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 " +echo "" +echo "Format the HDF5 C source using clang-format. The " +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