2012-08-16 20:49:48 -03:00
|
|
|
#!/bin/bash
|
|
|
|
DIR=$1
|
2012-08-16 21:37:45 -03:00
|
|
|
COMMIT=$2
|
|
|
|
|
|
|
|
function do_commit {
|
|
|
|
if [ $COMMIT == 1 ] ;then
|
|
|
|
git commit $1 --author="uncrustify <pat@moreproductive.org>" \
|
2012-08-16 21:49:45 -03:00
|
|
|
--message="uncrustify $1";
|
2012-08-16 21:37:45 -03:00
|
|
|
fi
|
|
|
|
}
|
2012-08-16 20:49:48 -03:00
|
|
|
|
|
|
|
function format_cpp {
|
|
|
|
echo 'format_cpp' $1
|
|
|
|
uncrustify --no-backup -c uncrustify_cpp.cfg $1
|
2012-08-16 21:37:45 -03:00
|
|
|
do_commit $1
|
2012-08-16 20:49:48 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
function format_header {
|
|
|
|
echo 'format_header' $1
|
|
|
|
uncrustify --no-backup -c uncrustify_headers.cfg $1
|
2012-08-16 21:37:45 -03:00
|
|
|
do_commit $1
|
2012-08-16 20:49:48 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
CPPFILES=`find $DIR -name '*.cpp' -print`
|
|
|
|
CFILES=`find $DIR -name '*.c' -print`
|
|
|
|
HFILES=`find $DIR -name '*.h' -print`
|
|
|
|
|
2016-05-06 13:24:05 -03:00
|
|
|
for f in $CPPFILES $CFILES; do
|
2012-08-16 20:49:48 -03:00
|
|
|
format_cpp $f
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
for f in $HFILES; do
|
|
|
|
format_header $f
|
|
|
|
done
|