uncrust 469 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. #
  3. # Run uncrustify for a file in-place
  4. #
  5. TMPDIR=`mktemp -d`
  6. HERE=`dirname "$0"`
  7. # Reformat a single file to tmp/
  8. if uncrustify -l CPP -c "$HERE/../share/uncrustify/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then
  9. cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file
  10. else
  11. echo "Something went wrong with uncrustify."
  12. fi
  13. # Clean up, deliberately
  14. [[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
  15. rmdir "$TMPDIR"