cloudflare/ClickHouse
Publicmirrored fromhttps://github.com/cloudflare/ClickHouse
utils/check-style/format.sh
15lines · modecode
7 years ago
| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Format almost all code with current clang-format settings |
| 4 | |
| 5 | cd `readlink -f $(dirname $0)`/../.. |
| 6 | |
| 7 | clang_format=`bash -c "compgen -c clang-format | grep 'clang-format-[[:digit:]]' | sort --version-sort --reverse | head -n1"` |
| 8 | if [ ! -z $clang_format ]; then |
| 9 | find dbms libs utils -name *.cpp -or -name *.h -exec $clang_format -i {} + ; |
| 10 | else |
| 11 | echo clang-format missing. try to install: |
| 12 | echo sudo apt install clang-format |
| 13 | echo or |
| 14 | echo sudo apt install clang-format-3.9 |
| 15 | fi |