From e36776ec11f407cfa555bc7df54ec05d92d04de6 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 17 May 2021 20:07:20 +0200 Subject: [PATCH] - add astyle script --- support/scripts/astyle.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 support/scripts/astyle.sh 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