mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Add clang-format scripts and github runner action (#5270)
This commit is contained in:
parent
17b91ecc2d
commit
e8389e0b2e
4 changed files with 102 additions and 0 deletions
29
run-clang-format.sh
Executable file
29
run-clang-format.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
# 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
|
||||
#
|
||||
# | sed 's| |\\ |g'
|
||||
# pipe the result of find into sed to
|
||||
# ensure all the paths returned by find have spaces escaped
|
||||
#
|
||||
# | xargs 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
|
Loading…
Add table
Add a link
Reference in a new issue