From e8023886f60ba3af0a63279da8dbc0d3eb0939a7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 13:31:56 +0200 Subject: [PATCH] made auto-formatter even more usable --- scripts/auto-formatter.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/auto-formatter.sh b/scripts/auto-formatter.sh index 33f3fabc2..cec0b6803 100755 --- a/scripts/auto-formatter.sh +++ b/scripts/auto-formatter.sh @@ -3,6 +3,12 @@ if [[ ! -f README.md ]]; then cd .. fi +folder_list=( + "./src" + "./hal" + "./tests" +) + cmake_fmt="cmake-format" if command -v ${cmake_fmt} &> /dev/null; then cmake_fmt_cmd="${cmake_fmt} -i CMakeLists.txt" @@ -12,15 +18,10 @@ else fi cpp_format="clang-format" -folder_list=( - "./src" - "./hal" - "./tests" -) file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp" if command -v ${cpp_format} &> /dev/null; then - echo "Auto-formatting ${dir} recursively" - for dir in ${allThreads[@]}; do + for dir in ${folder_list[@]}; do + echo "Auto-formatting ${dir} recursively" find ${dir} ${file_selectors} | xargs clang-format --style=file -i done else