Debian Codegraph @

bin/format_source

raw
1 #!/bin/bash
2 #
3 # Recursively format all C & C++ sources and header files, except those in the
4 # 'config' directory and generated files, such as ncgenyy.c, etc.
5 #
6 # Note that any files or directories that are excluded here should also be
7 # added to the 'exclude' list in .github/workflows/clang-format-check.yml
8
9 COMMAND="clang-format"
10
11 if [ $# -eq 1 ]; then
12 COMMAND="$COMMAND-$1"
13 fi
14
15 echo ""
16 echo "bin/format_source <version>"
17 echo ""
18 echo "Format the HDF4 source using clang-format. The <version>"
19 echo "parameter is optional and can be used to force a specific"
20 echo "installed version of clang-format to be used."
21 echo ""
22
23 find . \( -type d -path ./config -prune -and -not -path ./config \) \
24 -or \( -iname *.h -or -iname *.c -or -iname *.java \) \
25 | xargs -P0 -n1 ${COMMAND} -style=file -i -fallback-style=none
26
27 exit 0