-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathastyle.sh
executable file
·53 lines (40 loc) · 1.12 KB
/
astyle.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
CMD=`type -p astyle`
if [ ! -x "$CMD" ]; then
# not found exit
echo "please install astyle and restart this script"
exit 1
fi
ASTYLE2_VERSION="Artistic Style Version 2."
ASTYLE3_VERSION="Artistic Style Version 3."
ARTISTIC_STYLE_OPTIONS="\
--mode=c \
--style=allman \
--indent=force-tab=4 \
--indent-modifiers \
--indent-preproc-define \
--pad-oper \
--unpad-paren \
--pad-header \
--align-pointer=name \
--align-reference=name \
--formatted \
--lineend=linux"
if [[ "`$CMD --version 2>&1`" == ${ASTYLE3_VERSION}* ]]; then
ARTISTIC_STYLE_OPTIONS="$ARTISTIC_STYLE_OPTIONS --pad-comma --add-braces"
elif [[ "`$CMD --version 2>&1`" == ${ASTYLE2_VERSION}* ]]; then
ARTISTIC_STYLE_OPTIONS="$ARTISTIC_STYLE_OPTIONS --add-brackets"
else
echo "Requested version 2 or 3"
exit 2
fi
set -e
$CMD $ARTISTIC_STYLE_OPTIONS --suffix=none --recursive "SrcPony/*.cpp" "SrcPony/*.h"
#for i in $(find . -type f \( -name "*.cpp" -or -name "*.c" -or -name "*.h" \));
#do
# $CMD $ARTISTIC_STYLE_OPTIONS "$i";
#done
#for i in $(find . -type f \( -name "*.orig" -or -name "*~" -or -name "moc_*" \));
#do
# rm -if "$i";
#done