From 8633abaf88162bf30768ca1a66541cf0ebbd37e7 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Sun, 5 Jan 2020 08:37:05 +0000 Subject: [PATCH] Add clang-format-all.sh to format all project sources --- clang-format-all.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 clang-format-all.sh diff --git a/clang-format-all.sh b/clang-format-all.sh new file mode 100755 index 0000000..908fde8 --- /dev/null +++ b/clang-format-all.sh @@ -0,0 +1,7 @@ +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +SRC_DIR=${ROOT_DIR}/src +CLANG_FORMAT=${CLANG_FORMAT:-clang-format} + +# Double clang-format, as it seems that one pass isn't always enough +find ${SRC_DIR} -iname "*.h" -o -iname "*.cpp" | xargs ${CLANG_FORMAT} -i -style=file +find ${SRC_DIR} -iname "*.h" -o -iname "*.cpp" | xargs ${CLANG_FORMAT} -i -style=file \ No newline at end of file