Files
Bigfoot/format.sh
Romain BOULLARD 6cd9801ef7
Some checks failed
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Has been cancelled
GiteaCI (#1)
Reviewed-on: #1
Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com>
Co-committed-by: Romain BOULLARD <romain.boullard@protonmail.com>
2026-01-28 14:29:12 +00:00

32 lines
709 B
Bash

#!/bin/bash
# Variable that will hold the name of the clang-format command
FMT="clang-format"
# Function to format files
format() {
for f in $(find "$1" \( -name '*.h' -or -name '*.hpp' -or -name '*.m' -or -name '*.mm' -or -name '*.c' -or -name '*.cpp' \)); do
# Skip *_generated.h files
if [[ "$f" == *_generated* ]]; then
continue
fi
echo "format ${f}"
${FMT} -i "${f}"
done
echo "~~~ $1 Done ~~~"
}
# Check if argument is provided
if [ -z "$1" ]; then
echo "Please provide a directory as an argument."
exit 1
fi
# Check if directory exists
if [ ! -d "$1" ]; then
echo "$1 is not a valid directory."
exit 1
fi
format "$1"