File: astyle.sh

package info (click to toggle)
httraqt 1.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 2,780 kB
  • sloc: cpp: 7,970; sh: 177; makefile: 13
file content (44 lines) | stat: -rwxr-xr-x 909 bytes parent folder | download
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
#!/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=k&r \
--indent=spaces=4 \
--indent-classes \
--indent-switches \
--indent-col1-comments \
--indent-preprocessor \
--break-blocks \
--pad-oper \
--add-brackets \
--convert-tabs \
--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  "sources/*.cpp" "sources/*.h"