made auto-formatter even more re-usable

This commit is contained in:
Robin Müller 2022-05-17 13:31:33 +02:00
parent e49de9422a
commit 14a1b4a7ac
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 9 additions and 3 deletions

View File

@ -12,11 +12,17 @@ else
fi fi
cpp_format="clang-format" cpp_format="clang-format"
folder_list=(
"./src"
"./hal"
"./tests"
)
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp" file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then if command -v ${cpp_format} &> /dev/null; then
find ./src ${file_selectors} | xargs clang-format --style=file -i echo "Auto-formatting ${dir} recursively"
find ./hal ${file_selectors} | xargs clang-format --style=file -i for dir in ${allThreads[@]}; do
find ./tests ${file_selectors} | xargs clang-format --style=file -i find ${dir} ${file_selectors} | xargs clang-format --style=file -i
done
else else
echo "No ${cpp_format} tool found, not formatting C++/C files" echo "No ${cpp_format} tool found, not formatting C++/C files"
fi fi