Added new make.sh script
This commit is contained in:
parent
17e9fda04e
commit
c8f51182a6
33
make.sh
Executable file
33
make.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user