Created
July 9, 2017 08:02
-
-
Save ArseniyShestakov/a4bba9cab6904b3b35f16c2cf069b1bd to your computer and use it in GitHub Desktop.
Uncrustify testing script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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