@@ -24,12 +24,11 @@ COMMAND=$*
2424SCRIPTPATH=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
2525MAINSOURCE=$SCRIPTPATH /..
2626ALL_FILES=$( cd $MAINSOURCE && git ls-tree --full-tree --name-only -r HEAD | grep -e " .*\.\(c\|h\|cc\|cpp\|hh\)\$ " )
27- CLANG_FORMAT_MAJOR_VERSION=17
2827
29- if " clang-format-$CLANG_FORMAT_MAJOR_VERSION " --version 2> /dev/null | grep -qF " version $CLANG_FORMAT_MAJOR_VERSION . " ; then
30- cd $MAINSOURCE ; " clang-format-$CLANG_FORMAT_MAJOR_VERSION " --style=file --verbose -i " $@ " $ALL_FILES
28+ if clang-format-17 --version 2> /dev/null | grep -qF ' version 17. ' ; then
29+ cd $MAINSOURCE ; clang-format-17 --style=file --verbose -i " $@ " $ALL_FILES
3130 exit 0
32- elif clang-format --version 2> /dev/null | grep -qF " version $CLANG_FORMAT_MAJOR_VERSION . " ; then
31+ elif clang-format --version 2> /dev/null | grep -qF ' version 17. ' ; then
3332 cd $MAINSOURCE ; clang-format --style=file --verbose -i " $@ " $ALL_FILES
3433 exit 0
3534fi
@@ -38,10 +37,6 @@ command -v docker >/dev/null 2>&1 || { echo >&2 "Please install docker. E.g., go
3837docker info > /dev/null 2>&1 || { echo >&2 " Docker server is not running? type 'docker info'." ; exit 1; }
3938
4039if [ -t 0 ]; then DOCKER_ARGS=-it; fi
40+ docker pull kszonek/clang-format-17
4141
42- docker run --rm $DOCKER_ARGS \
43- -v " $MAINSOURCE " :" $MAINSOURCE " :Z \
44- -w " $MAINSOURCE " \
45- -u " $( id -u $USER ) :$( id -g $USER ) " \
46- " ghcr.io/jidicula/clang-format:$CLANG_FORMAT_MAJOR_VERSION " \
47- --style=file --verbose -i " $@ " $ALL_FILES
42+ docker run --rm $DOCKER_ARGS -v " $MAINSOURCE " :" $MAINSOURCE " :Z -w " $MAINSOURCE " -u " $( id -u $USER ) :$( id -g $USER ) " kszonek/clang-format-17 --style=file --verbose -i " $@ " $ALL_FILES
0 commit comments