Commit ea9a120d authored by Adam Procter's avatar Adam Procter Committed by GitHub

Detect macOS and adapt sed usage in clang-format version check script; also fix…

Detect macOS and adapt sed usage in clang-format version check script; also fix small typo in err msg (#169)
parent a5353cc0
......@@ -32,7 +32,7 @@ clang_format_lib_verify_version() {
local REQUIRED_VERSION_X_Y="${2}"
if ! [[ "${REQUIRED_VERSION_X_Y}" =~ ^[0-9]+.[0-9]+$ ]]; then
bash_lib_print_error "${FUNCNAME[0]}: required-version-number must have the form (numerber).(number)."
bash_lib_print_error "${FUNCNAME[0]}: required-version-number must have the form (number).(number)."
return 1
fi
......@@ -47,8 +47,15 @@ clang_format_lib_verify_version() {
return 1
fi
local SED_FLAGS
if [[ "$(uname)" == 'Darwin' ]]; then
SED_FLAGS='-En'
else
SED_FLAGS='-rn'
fi
local VERSION_X_Y
if ! VERSION_X_Y=$(echo "${VERSION_LINE}" | sed -rn 's/^clang-format version ([0-9]+.[0-9]+).*$/\1/p')
if ! VERSION_X_Y=$(echo "${VERSION_LINE}" | sed ${SED_FLAGS} 's/^clang-format version ([0-9]+.[0-9]+).*$/\1/p')
then
bash_lib_print_error "Failed invocation of sed."
return 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment