drogon/format.sh

15 lines
574 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2019-05-17 22:49:09 +08:00
# You can customize the clang-format path by setting the CLANG_FORMAT environment variable
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
2024-01-30 09:57:58 +08:00
# Check if clang-format version is 17 to avoid inconsistent formatting
$CLANG_FORMAT --version
2024-01-30 09:57:58 +08:00
if [[ ! $($CLANG_FORMAT --version) =~ "version 17" ]]; then
echo "Error: clang-format version must be 17"
exit 1
fi
2021-05-28 09:52:34 +08:00
find lib orm_lib nosql_lib examples drogon_ctl -name *.h -o -name *.cc -exec dos2unix {} \;
find lib orm_lib nosql_lib examples drogon_ctl -name *.h -o -name *.cc|xargs $CLANG_FORMAT -i -style=file