clang_format.hook 526 字节
Newer Older
1 2 3
#!/bin/bash
set -e

4
readonly VERSION="13.0.0"
5 6 7

version=$(clang-format -version)

8
if ! [[ $(python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}') -ge 36 ]]; then
9
    echo "clang-format installation by pip need python version great equal 3.6,
10 11 12 13
          please change the default python to higher version."
    exit 1
fi

14
if ! [[ $version == *"$VERSION"* ]]; then
15
    # low version of pip may not have the source of clang-format whl
16
    pip install --upgrade pip
17
    pip install clang-format==13.0.0
18 19 20
fi

clang-format $@