Files
Bigfoot/format.sh
Romain BOULLARD f3a1c7ec36
Some checks failed
Bigfoot / build-and-test (Debug, ON) (push) Successful in 25s
Bigfoot / build-and-test (RelWithDebInfo, OFF) (push) Successful in 27s
Bigfoot / build-and-test (RelWithDebInfo, ON) (push) Successful in 25s
Bigfoot / build-and-test (Release, OFF) (push) Successful in 20s
Bigfoot / build-and-test (Release, ON) (push) Has been cancelled
Bigfoot / build-and-test (Debug, OFF) (push) Successful in 26s
Update compilation
2026-01-28 14:28:07 +01: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"