From cfa6843c8f3fc57617482fd5f359bfab7941c9a3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 13 May 2022 11:46:04 +0200 Subject: [PATCH] check whether clang-format is installed --- scripts/apply-clang-format.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/apply-clang-format.sh b/scripts/apply-clang-format.sh index 97783e95d..fe05ddd2c 100755 --- a/scripts/apply-clang-format.sh +++ b/scripts/apply-clang-format.sh @@ -7,8 +7,15 @@ cmake_fmt="cmake-format" if command -v ${cmake_fmt} &> /dev/null; then cmake_fmt_cmd="${cmake_fmt} -i CMakeLists.txt" eval ${cmake_fmt_cmd} +else + echo "No cmake-format tool found, not formatting CMake files" fi -find ./src -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i -find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i -find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i +cpp_format="clang-format" +if command -v ${clang-format} &> /dev/null; then + find ./src -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i + find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i + find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i +else + echo "No clang-format tool found, not formatting C++/C files" +fi \ No newline at end of file