Skip to content

Commit

Permalink
Adds an optional version arg to bin/format_source (HDFGroup#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Jun 14, 2023
1 parent d1ef48e commit 61d43eb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin/format_source
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

0 comments on commit 61d43eb

Please sign in to comment.