2019-07-03 21:52:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
SRCROOT=`git rev-parse --show-toplevel`
|
|
|
|
CFG="$SRCROOT/scripts/uncrustify.cfg"
|
|
|
|
echo "srcroot: $SRCROOT"
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
-c|--check)
|
|
|
|
OPTS="--check"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
OPTS="--replace --no-backup"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-09-29 09:13:55 +00:00
|
|
|
ARGS=4
|
|
|
|
JOBS=4
|
|
|
|
|
2019-07-03 21:52:56 +00:00
|
|
|
pushd "$SRCROOT"
|
2020-09-29 09:13:55 +00:00
|
|
|
git ls-tree --name-only -r HEAD | grep -E '.*\.[ch]$' | grep -v nbis | grep -v fpi-byte | grep -v build/ | xargs -n$ARGS -P $JOBS uncrustify -c "$CFG" $OPTS
|
2019-07-03 21:52:56 +00:00
|
|
|
RES=$?
|
|
|
|
popd
|
2020-09-29 09:13:55 +00:00
|
|
|
exit $RES
|