scripts: avoid unclear error message
"scripts/reformat-source: 18: scripts/reformat-source: -style=file: not found"
@@ -9,10 +9,16 @@ SCRIPTS_DIR=$(dirname "$0")
. "${SCRIPTS_DIR}/include-common"
CLANG_FORMAT=$(which clang-format-5.0)
+
if [ -z "${CLANG_FORMAT}" ]; then
CLANG_FORMAT=$(which clang-format)
fi
+if [ -z "${CLANG_FORMAT}" ]; then
+ echo "Please install clang-format 5, 6, or 7"
+ exit 0
+fi
+
cd "$SOURCE"
$($CLANG_FORMAT -style=file -i `find . -name '*.[ch]' -or -name '*.[ch]pp' -or -name '*.[ch].in' | egrep -v "^(./src/tools/gen|./tests/gtest-1.7.0)"`)
