simplify clang-format script (#5274)

checked that -print0 & -0 also exist in apple's manpages
This commit is contained in:
Philip Dubé 2025-04-03 04:36:10 +00:00 committed by GitHub
parent 1e51f1e162
commit ef8fa17e7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,12 +18,11 @@
# ! -path "soh/assets/*"
# asset headers are autogenerated, don't fight them
#
# | sed 's| |\\ |g'
# pipe the result of find into sed to
# ensure all the paths returned by find have spaces escaped
# -print0
# separate paths with NUL bytes, avoiding issues with spaces in paths
#
# | xargs clang-format-14 -i
# | xargs -0 clang-format-14 -i
# use xargs to take each path we've found
# and pass it as an argument to clang-format
find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" | sed 's| |\\ |g' | xargs clang-format-14 -i
find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" -print0 | xargs -0 clang-format-14 -i