diff --git a/support/scripts/astyle.sh b/support/scripts/astyle.sh new file mode 100755 index 00000000..f5ddf519 --- /dev/null +++ b/support/scripts/astyle.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# astyle.sh - Formatting source code using astyle +# +# Copyright (C) 2018 Sven Hoefer +# License: WTFPLv2 +# + +usage() { + echo "Usage: astyle.sh ..." +} + +test "$1" == "--help" && { usage; exit 0; } +test -z "$1" && { usage; exit 1; } + +type astyle >/dev/null 2>&1 || { echo >&2 "Astyle required, but it's not installed. Aborting."; exit 1; } + +for file in $@; do + astyle \ + --suffix=none \ + --style=allman \ + --formatted -v \ + \ + --indent=force-tab=8 \ + --indent-classes \ + --indent-preproc-define \ + --indent-switches \ + --max-instatement-indent=80 \ + --lineend=linux \ + \ + --unpad-paren \ + \ + --pad-oper \ + --pad-header \ + \ + --align-pointer=name \ + \ + $file +done