From b720e63a872f4d7bad3f8d75692a0b70c4a210e0 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Sat, 25 May 2019 08:49:56 +0200 Subject: [PATCH] added more options and better output --- do-clang-format.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/do-clang-format.sh b/do-clang-format.sh index ebfcb2322..816ef19bd 100755 --- a/do-clang-format.sh +++ b/do-clang-format.sh @@ -4,7 +4,12 @@ command="clang-format -style=file `find . -iregex '^.*\.\(cc\|h\)$' -not -path ' if [ "$1" == "check" ]; then - ! ${command} -output-replacements-xml | grep -c "<replacement " -else + `! ${command} -output-replacements-xml | grep -qc "<replacement "` || \ + { echo "format-check FAILED!"; exit $ERRCODE; } + echo "Congratulations: format-check succeeded" +elif [ "$1" == "apply" ]; +then ${command} -i +else + echo "please use: ./do-clang-format.sh [check] or [apply]" fi -- GitLab