Reformat runastyle using https://arachnoid.com/python/python_programs/beautify_bash.py
This commit is contained in:
parent
5e7f491bd4
commit
ad9d580e5f
28
runastyle
28
runastyle
|
@ -11,19 +11,19 @@ ASTYLE="${ASTYLE-astyle}"
|
||||||
|
|
||||||
DETECTED_VERSION=$("$ASTYLE" --version 2>&1 | awk '{ print $NF; }')
|
DETECTED_VERSION=$("$ASTYLE" --version 2>&1 | awk '{ print $NF; }')
|
||||||
if [ "$DETECTED_VERSION" != "${ASTYLE_VERSION}" ]; then
|
if [ "$DETECTED_VERSION" != "${ASTYLE_VERSION}" ]; then
|
||||||
echo "You should use version: ${ASTYLE_VERSION}"
|
echo "You should use version: ${ASTYLE_VERSION}"
|
||||||
echo "Detected version: ${DETECTED_VERSION}"
|
echo "Detected version: ${DETECTED_VERSION}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RCFILE=.astylerc
|
RCFILE=.astylerc
|
||||||
|
|
||||||
function formatCplusplus {
|
function formatCplusplus {
|
||||||
"$ASTYLE" --options=$RCFILE "$1"
|
"$ASTYLE" --options=$RCFILE "$1"
|
||||||
}
|
}
|
||||||
function formatCplusplusRecursive {
|
function formatCplusplusRecursive {
|
||||||
RCFILE=.astylerc
|
RCFILE=.astylerc
|
||||||
"$ASTYLE" --options=$RCFILE --recursive "$1"
|
"$ASTYLE" --options=$RCFILE --recursive "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
formatCplusplus "cli/*.cpp"
|
formatCplusplus "cli/*.cpp"
|
||||||
|
@ -48,23 +48,23 @@ formatCplusplusRecursive "samples/*.cpp"
|
||||||
# sed -i "s/\t/ /g" test/test*.cpp
|
# sed -i "s/\t/ /g" test/test*.cpp
|
||||||
|
|
||||||
function formatXML {
|
function formatXML {
|
||||||
xmllint --format -o "$1_" "$1"
|
xmllint --format -o "$1_" "$1"
|
||||||
if cmp -s "$1_" "$1"; then
|
if cmp -s "$1_" "$1"; then
|
||||||
rm -f "$1_"
|
rm -f "$1_"
|
||||||
else
|
else
|
||||||
mv -f "$1_" "$1"
|
mv -f "$1_" "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# format config files
|
# format config files
|
||||||
# TODO: use other tool than xmllint? use tabs instead of spaces?
|
# TODO: use other tool than xmllint? use tabs instead of spaces?
|
||||||
for CFGFILE in cfg/*.cfg
|
for CFGFILE in cfg/*.cfg
|
||||||
do
|
do
|
||||||
formatXML "$CFGFILE"
|
formatXML "$CFGFILE"
|
||||||
done
|
done
|
||||||
for PLATFORMFILE in platforms/*.xml
|
for PLATFORMFILE in platforms/*.xml
|
||||||
do
|
do
|
||||||
formatXML "$PLATFORMFILE"
|
formatXML "$PLATFORMFILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
formatXML man/cppcheck.1.xml
|
formatXML man/cppcheck.1.xml
|
||||||
|
|
Loading…
Reference in New Issue