2022-05-13 11:56:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
if [[ ! -f README.md ]]; then
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake_fmt="cmake-format"
|
2022-05-16 14:54:43 +02:00
|
|
|
file_selectors="-iname CMakeLists.txt"
|
2022-05-13 11:56:37 +02:00
|
|
|
if command -v ${cmake_fmt} &> /dev/null; then
|
2022-05-16 14:54:43 +02:00
|
|
|
${cmake_fmt} -i CMakeLists.txt
|
2022-08-03 13:15:49 +02:00
|
|
|
find ./src ${file_selectors} | xargs ${cmake_fmt} -i
|
|
|
|
find ./unittests ${file_selectors} | xargs ${cmake_fmt} -i
|
2022-05-13 11:56:37 +02:00
|
|
|
else
|
|
|
|
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
|
|
|
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
|
2022-05-16 14:54:43 +02:00
|
|
|
find ./src ${file_selectors} | xargs ${cpp_format} --style=file -i
|
2022-07-18 16:07:26 +02:00
|
|
|
find ./unittests ${file_selectors} | xargs ${cpp_format} --style=file -i
|
2022-05-13 11:56:37 +02:00
|
|
|
else
|
|
|
|
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
|
|
|
fi
|