Skip to content

Instantly share code, notes, and snippets.

@ArseniyShestakov
Created July 9, 2017 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArseniyShestakov/a4bba9cab6904b3b35f16c2cf069b1bd to your computer and use it in GitHub Desktop.
Save ArseniyShestakov/a4bba9cab6904b3b35f16c2cf069b1bd to your computer and use it in GitHub Desktop.
Uncrustify testing script
#!/bin/bash
# Open vcmi.cfg in your favorite editor one one side and terminal on other side
# --color option only available in diffutils 3.4 (2016-08-08)
# for older version of diff use "colordiff" tool instead:
# diff -u source.cpp source.cpp.uncrustify | colordiff
VCMICFG="/home/i/UNTEST/vcmi.cfg"
SRC="/home/i/UNTEST/source.cpp"
SRCUN="/home/i/UNTEST/source.cpp.uncrustify"
SRCUNOLD="/home/i/UNTEST/source.cpp.uncrustify.old"
rm -f $SRCUN
cp $SRC $SRCUN
while true;
do
inotifywait -e close_write $VCMICFG > /dev/null 2>&1
clear
uncrustify -q -c $VCMICFG --check $SRCUN
ERROR_CODE=$?
if [ ${ERROR_CODE} != 0 ]; then
uncrustify -q -c $VCMICFG -f $SRCUN | diff --color -u $SRCUN --to-file=/dev/stdin
uncrustify -q -c $VCMICFG --replace $SRCUN
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment