easier linter

This commit is contained in:
2024-08-29 14:35:33 +02:00
parent 92098b6ba1
commit c2a3e8417a

24
lint.sh
View File

@@ -1,32 +1,14 @@
#!/bin/bash
if (( $# != 2 )); then
if (( $# < 1 )); then
>&2 echo "Illegal number of parameters"
exit 1
fi
INPUT=$1
EXCLUDE=$2
function get_files() {
while read p; do
find "$p" -regex '.*\.\(c\|cpp\|h\)$' | grep -vFf $2
done < $1
}
if [ ! -f $1 ]; then
echo "File not found!"
exit 1
fi
if [ ! -f $2 ]; then
echo "File not found!"
exit 1
fi
# save unsaved work
git stash --include-untracked
get_files $1 $2 | xargs clang-format -i
clang-format -i "$@"
git add -A && git commit -m "Lint"