From c8f51182a6e623aa2506bd8fc9efa8e00a943dd6 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Jan 2017 01:09:25 -0500 Subject: [PATCH] Added new make.sh script --- make.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 make.sh diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..40a19cb --- /dev/null +++ b/make.sh @@ -0,0 +1,33 @@ +if [ -z "$1" ]; then + echo "Usage:" >&2 + echo "$0 lang > autoformat.sh" >&2 + exit 1 +fi +OPTS="${OPTS:---mode=$1}" +GLOB="${GLOB:-**/*.$1}" +# --style=google : google style (similar to 1tbs) +# -H : Pad header (space after if, for, while) +# -K : Indent cases +# -N : Indent namespaces +# -S : Indent switches +# -j : Always add brackets (even on one line if statements) +# -n : Don't make a backup +# -p : Pad operators +# -s2 : Two spaces +# -xG : Indent modifiers +# -xc : Brace attached to class names +# -xe : Erase blank lines +# -xl : Attach inlines +# -xn : Attach bracket to namespace +# -z2 : Force Linux lineending +BASE_OPTS='-H -K -N -S -j -n -p -s2 -xG -xc -xe -xl -xn -z2' + +cat << EOF +#!/bin/zsh +# For support: +# https://austenwares.com/gogs/stonewareslord/autoformat/src/java +# +GLOB=( $GLOB ) +OPTS=( $BASE_OPTS $OPTS ) +astyle \$OPTS \$GLOB|\\grep -P '^(?!Unchanged)'||true +EOF