2016-07-20 15:27:27 -04:00
|
|
|
#!/bin/zsh
|
|
|
|
\cd "$(dirname "$0")">/dev/null
|
|
|
|
# Options:
|
|
|
|
# --mode=java : Java formatting
|
|
|
|
# -xc : Brace attached to class names
|
|
|
|
# --style=google : Google style (similar to 1tbs)
|
|
|
|
# -j : Always add brackets (even on one line if statements)
|
|
|
|
# -s2 : Three spaces
|
|
|
|
# -xG : Indent modifiers (C++ only, but i'm keeping it)
|
|
|
|
# -S : Indent switches
|
|
|
|
# -K : Indent cases
|
|
|
|
# -N : Indent namespaces (unsure if this applies to Java, keeping it anyway)
|
|
|
|
# -xn : Attach bracket to namespace
|
|
|
|
# -xl : Attach inlines
|
|
|
|
# -n : Don't make a backup
|
|
|
|
# -p : Pad operators
|
|
|
|
# -H : Pad header (space after if, for, while)
|
|
|
|
OPTS=( --mode=java -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H )
|
|
|
|
GLOB=( src/**/*.java )
|
2016-07-22 15:36:27 -04:00
|
|
|
astyle $OPTS $GLOB|\grep -vE '^Unchanged'
|
2016-07-20 15:32:00 -04:00
|
|
|
# Get rid of newlines
|
2016-07-22 15:35:20 -04:00
|
|
|
perl -ni'' -e '/^\s*$/ || print' $GLOB
|
2016-07-20 15:27:27 -04:00
|
|
|
\cd ->/dev/null
|