2020-06-06 08:54:12 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Run uncrustify for a file in-place
|
|
|
|
#
|
|
|
|
|
|
|
|
TMPDIR=`mktemp -d`
|
2023-12-27 06:13:26 +00:00
|
|
|
HERE=`dirname "$0"`
|
2020-06-06 08:54:12 +00:00
|
|
|
|
|
|
|
# Reformat a single file to tmp/
|
2024-08-29 20:36:00 +00:00
|
|
|
if uncrustify -l CPP -c "$HERE/../share/uncrustify/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then
|
2021-03-30 01:00:57 +00:00
|
|
|
cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file
|
|
|
|
else
|
|
|
|
echo "Something went wrong with uncrustify."
|
|
|
|
fi
|
2020-06-06 08:54:12 +00:00
|
|
|
|
|
|
|
# Clean up, deliberately
|
2021-03-30 01:00:57 +00:00
|
|
|
[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
|
2020-06-06 08:54:12 +00:00
|
|
|
rmdir "$TMPDIR"
|