Skip to content

Commit d658720

Browse files
committedMar 10, 2017
Use system uncrustify too in indent.sh
1 parent 7722c0a commit d658720

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed
 

‎sys/indent.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ fi
5353

5454
if [ "${UNCRUST}" = 1 ]; then
5555
# yell, rather than overwrite an innocent file
56-
if ! r2pm -r type uncrustify >/dev/null; then
57-
echo "This script requires uncrustify to function. Check r2pm -i uncrustify"
58-
exit 1
59-
fi
56+
command -v uncrustify >/dev/null 2>&1 || {
57+
if ! r2pm -r type uncrustify >/dev/null; then
58+
echo "This script requires uncrustify to function. Check r2pm -i uncrustify"
59+
exit 1
60+
fi
61+
}
6062
else
6163
# yell, rather than overwrite an innocent file
6264
if ! type clang-format >/dev/null; then
@@ -75,7 +77,11 @@ indentFile() {
7577
if [ "${UNCRUST}" = 1 ]; then
7678
cp -f doc/clang-format ${CWD}/.clang-format
7779
cd "$CWD"
78-
r2pm -r uncrustify -c ${CWD}/doc/uncrustify.cfg -f "${IFILE}" > .tmp-format || exit 1
80+
if command -v uncrustify >/dev/null 2>&1; then
81+
uncrustify -c ${CWD}/doc/uncrustify.cfg -f "${IFILE}" > .tmp-format || exit 1
82+
else
83+
r2pm -r uncrustify -c ${CWD}/doc/uncrustify.cfg -f "${IFILE}" > .tmp-format || exit 1
84+
fi
7985
else
8086
cp -f doc/clang-format ${CWD}/.clang-format
8187
cd "$CWD"

0 commit comments

Comments
 (0)
Please sign in to comment.