- version=$($formatter --version)
-
- # shellcheck disable=SC2181
- if (($? != 0)); then
- echo "Cannot execute \`$formatter --version\`." >&2
+ if ! version=$("${formatter[@]}" --version); then
+ echo "Cannot execute \`${formatter[*]} --version\`." >&2
find "$root_dir" \( -name '*.cpp' -o -name '*.hpp' \) \
! -wholename '*/cpp-common/optional.hpp' \
! -wholename '*/cpp-common/string_view.hpp' \
! -wholename '*/cpp-common/nlohmann/json.hpp' \
find "$root_dir" \( -name '*.cpp' -o -name '*.hpp' \) \
! -wholename '*/cpp-common/optional.hpp' \
! -wholename '*/cpp-common/string_view.hpp' \
! -wholename '*/cpp-common/nlohmann/json.hpp' \
elif command -v clang-format-$expected_formatter_major_version &> /dev/null; then
# Try using the expected version of clang-format
elif command -v clang-format-$expected_formatter_major_version &> /dev/null; then
# Try using the expected version of clang-format