clang_format.hook 526 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. set -e
  3. readonly VERSION="13.0.0"
  4. version=$(clang-format -version)
  5. if ! [[ $(python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}') -ge 36 ]]; then
  6. echo "clang-format installation by pip need python version great equal 3.6,
  7. please change the default python to higher version."
  8. exit 1
  9. fi
  10. if ! [[ $version == *"$VERSION"* ]]; then
  11. # low version of pip may not have the source of clang-format whl
  12. pip install --upgrade pip
  13. pip install clang-format==13.0.0
  14. fi
  15. clang-format $@