clang-format.bash: minor fixes to support MacOS

- sed on Mac does not support embedded sed statements, hence eliminating
  the non-matches via grep

- xargs on Mac does not support -d, but does support -0, hence replacing
This commit is contained in:
Matthias Maennich
2017-10-03 22:16:07 +02:00
parent 046625d26f
commit 574d694337

View File

@@ -111,7 +111,9 @@ $git_ls |
# Select sources with our attribute.
git check-attr --stdin format.clang-format |
sed -n '/: format\.clang-format: set$/ {s/:[^:]*:[^:]*$//p}' |
grep -e ': format\.clang-format: set$' |
sed -n 's/:[^:]*:[^:]*$//p' |
# Update sources in-place.
xargs -d '\n' "$clang_format" -i
tr '\n' '\0' |
xargs -0 "$clang_format" -i