File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed
Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2+ # Used to format files to the given format using clang format.
23
34# Variable that will hold the name of the clang-format command
45FMT=" "
56
6- FOLDERS=(" src" " test" )
7-
87# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent
98# that the version number be part of the command. We prefer clang-format if
10- # that's present, otherwise we check clang-format-13
9+ # that's present, otherwise we check clang-format-13
1110for clangfmt in clang-format{,-13}; do
1211 if which " $clangfmt " & > /dev/null; then
1312 FMT=" $clangfmt "
@@ -21,21 +20,6 @@ if [ -z "$FMT" ]; then
2120 exit 1
2221fi
2322
24- function format() {
25- # ignore getRSS.h file
26- for f in $( find $@ -name ' *.h' ! -iname ' getRSS.h' -or -name ' *.m' -or -name ' *.mm' -or -name ' *.c' -or -name ' *.cpp' ) ; do
27- echo " format ${f} " ;
28- ${FMT} -i ${f} ;
29- done
30-
31- echo " ~~~ $@ Done ~~~" ;
32- }
23+ files=$( find . \( -path ./build -prune -o -path ./.git -prune \) -o -type f -name " *[h|c]pp" -print)
3324
34- # Check all of the arguments first to make sure they're all directories
35- for dir in ${FOLDERS[@]} ; do
36- if [ ! -d " ${dir} " ]; then
37- echo " ${dir} is not a directory" ;
38- else
39- format ${dir} ;
40- fi
41- done
25+ ${FMT} -i ${files}
You can’t perform that action at this time.
0 commit comments