2025-04-01 17:09:44 -04:00
|
|
|
# this line does quite a bit, so let's break it down
|
|
|
|
#
|
|
|
|
# find soh
|
|
|
|
# use "find" to look in the "soh" directory
|
|
|
|
# this ensures we don't try to format stuff in the submodules
|
|
|
|
#
|
|
|
|
# -type f
|
|
|
|
# only look for files
|
|
|
|
#
|
|
|
|
# -name "*.c" -o -name "*.cpp"
|
|
|
|
# find all .c and .cpp files
|
|
|
|
#
|
|
|
|
# -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h"
|
|
|
|
# find all .h files that aren't in soh/src or soh/include
|
|
|
|
# this is because zret decomp only runs clang-format on c files
|
|
|
|
# https://github.com/zeldaret/mm/blob/b7e5468ca16315a7e322055eff3d97fe980bbc25/format.py#L182
|
|
|
|
#
|
|
|
|
# ! -path "soh/assets/*"
|
|
|
|
# asset headers are autogenerated, don't fight them
|
|
|
|
#
|
2025-04-03 04:36:10 +00:00
|
|
|
# -print0
|
|
|
|
# separate paths with NUL bytes, avoiding issues with spaces in paths
|
2025-04-01 17:09:44 -04:00
|
|
|
#
|
2025-04-03 15:23:47 -04:00
|
|
|
# | xargs -0 clang-format-14 -i -verbose
|
2025-04-01 17:09:44 -04:00
|
|
|
# use xargs to take each path we've found
|
|
|
|
# and pass it as an argument to clang-format
|
2025-04-03 15:23:47 -04:00
|
|
|
# verbose to print files being formatted and X out of Y status
|
2025-04-01 17:09:44 -04:00
|
|
|
|
2025-04-03 15:23:47 -04:00
|
|
|
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 --verbose
|