drogon/format.sh

15 lines
574 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2019-05-17 14:49:09 +00:00
# You can customize the clang-format path by setting the CLANG_FORMAT environment variable
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
# Check if clang-format version is 14 to avoid inconsistent formatting
$CLANG_FORMAT --version
if [[ ! $($CLANG_FORMAT --version) =~ "version 14" ]]; then
echo "Error: clang-format version must be 14"
exit 1
fi
2021-05-28 01:52:34 +00: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