minor improvements for auto-formatter

This commit is contained in:
Robin Müller 2022-05-16 14:54:43 +02:00
parent f0debecbbc
commit 1e7032f89c
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 6 additions and 5 deletions

View File

@ -4,9 +4,10 @@ if [[ ! -f README.md ]]; then
fi
cmake_fmt="cmake-format"
file_selectors="-iname CMakeLists.txt"
if command -v ${cmake_fmt} &> /dev/null; then
cmake_fmt_cmd="${cmake_fmt} -i CMakeLists.txt"
eval ${cmake_fmt_cmd}
${cmake_fmt} -i CMakeLists.txt
find ./src ${file_selectors} | xargs ${cmake_fmt} -i
else
echo "No ${cmake_fmt} tool found, not formatting CMake files"
fi
@ -14,9 +15,9 @@ fi
cpp_format="clang-format"
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then
find ./src ${file_selectors} | xargs clang-format --style=file -i
find ./hal ${file_selectors} | xargs clang-format --style=file -i
find ./tests ${file_selectors} | xargs clang-format --style=file -i
find ./src ${file_selectors} | xargs ${cpp_format} --style=file -i
find ./hal ${file_selectors} | xargs ${cpp_format} --style=file -i
find ./tests ${file_selectors} | xargs ${cpp_format} --style=file -i
else
echo "No ${cpp_format} tool found, not formatting C++/C files"
fi