2020-05-21 21:14:40 +08:00
|
|
|
#!/usr/bin/env bash
|
2019-05-17 22:49:09 +08:00
|
|
|
|
2023-08-27 20:54:22 +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
|
2023-08-27 20:54:22 +08:00
|
|
|
$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"
|
2023-08-27 20:54:22 +08:00
|
|
|
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 {} \;
|
2023-08-27 20:54:22 +08:00
|
|
|
find lib orm_lib nosql_lib examples drogon_ctl -name *.h -o -name *.cc|xargs $CLANG_FORMAT -i -style=file
|