Browse Source

- astyle: align options; add projects script

master
vanhofen 4 years ago
parent
commit
bdd90adfa2
  1. 29
      support/scripts/astyle-project.sh
  2. 7
      support/scripts/astyle.sh

29
support/scripts/astyle-project.sh

@ -0,0 +1,29 @@
#!/bin/sh
#
# astyle-project.sh - Formatting source code using astyle
#
# Copyright (C) 2021 Sven Hoefer <svenhoefer@svenhoefer.com>
# License: WTFPLv2
#
usage() {
echo "Usage: astyle-project.sh <project-directory>"
}
test "$1" == "--help" && { usage; exit 0; }
test -z "$1" && { usage; exit 1; }
type astyle.sh >/dev/null 2>&1 || { echo >&2 "astyle.sh required. Aborting."; exit 1; }
PROJECT=$1
files=$(find ${PROJECT}/ -type f -name '*.c' -or -name '*.cpp' -or -name '*.h')
if [ -z "$files" ]; then
exit 0
fi
for file in $files; do
astyle.sh $file
dos2unix -k $file
done

7
support/scripts/astyle.sh

@ -21,17 +21,22 @@ for file in $@; do
--style=allman \
--formatted -v \
\
--indent=force-tab=8 \
--convert-tabs \
--indent=tab \
--indent-classes \
--indent-preproc-define \
--indent-switches \
--indent-after-parens \
--max-instatement-indent=80 \
--lineend=linux \
\
--unpad-paren \
\
--pad-oper \
--pad-comma \
--pad-header \
--pad-param-type \
--attach-return-type-decl \
\
--align-pointer=name \
\

Loading…
Cancel
Save