Reformat Source: Print info about `clang-format`
@@ -10,12 +10,17 @@ SCRIPTS_DIR=$(dirname "$0")
CLANG_FORMAT=$(which clang-format-6.0 || which clang-format)
-if [ -n "${CLANG_FORMAT}" ]; then
- version=$("${CLANG_FORMAT}" --version 2> /dev/null | sed -E 's/.* ([6-9]+)\.[0-9].[0-9] .*/\1/')
- [ "$version" -ge 6 ] || unset CLANG_FORMAT
+if [ -n "$CLANG_FORMAT" ]; then
+ location="$CLANG_FORMAT"
+ version=$("$CLANG_FORMAT" --version 2> /dev/null)
+ majorVersion=$(printf '%s' "$version" | sed -E 's/.* ([6-9]+)\.[0-9].[0-9] .*/\1/')
+ [ "$majorVersion" -ge 6 ] 2> /dev/null || unset CLANG_FORMAT
fi
if [ -z "${CLANG_FORMAT}" ]; then
+ printf 'ClangFormat: %s\n' "$location"
+ printf 'Version Info: %s\n' "$version"
+ printf 'Major Version: %s\n' "$majorVersion"
echo "Please install clang-format 6, or 7"
exit 0
fi
