Skip to content

Instantly share code, notes, and snippets.

@winteryoung
Created December 4, 2017 05:22
Show Gist options
  • Save winteryoung/fda7a7c553fbb1b6f4aa1246b6d84ffc to your computer and use it in GitHub Desktop.
Save winteryoung/fda7a7c553fbb1b6f4aa1246b6d84ffc to your computer and use it in GitHub Desktop.
#!/bin/sh
if [[ $EUID > 0 ]]
then echo "Please run as root."
exit
fi
PROXY_HOST=localhost
PROXY_PORT=7777
VERSION=1.5
mkdir /usr/local/lib/google-java-format
wget https://github.com/google/google-java-format/releases/download/google-java-format-$VERSION/google-java-format-$VERSION-all-deps.jar -O /usr/local/lib/google-java-format/google-java-format-$VERSION.jar -e use_proxy=yes -e http_proxy=$PROXY_HOST:$PROXY_PORT -e https_proxy=$PROXY_HOST:$PROXY_PORT
cat > /usr/local/bin/google-java-format <<EOF
java -jar /usr/local/lib/google-java-format/google-java-format-$VERSION.jar "\$@"
EOF
chmod +x /usr/local/bin/google-java-format
echo Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment