Last active
March 27, 2016 13:44
-
-
Save franzbecker/b4bb77f66d36472548bf to your computer and use it in GitHub Desktop.
Bash function for using ./gradlew or gradle as fall-back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call ./gradlew or gradle as fall-back | |
function g() { | |
if [ -f gradlew ]; then | |
./gradlew $@ | |
else | |
# if there is no ./gradlew check if there is a build.gradle file | |
# if not ask the user for confirmation (avoid creation of .gradle dir in unrelated directories) | |
if [ -f build.gradle ]; then | |
gradle $@ | |
else | |
read -n1 -p "There is no build.gradle in this directory. Do you want to continue? [y,n]" doit | |
echo "" | |
case $doit in | |
y|Y) gradle $@ ;; | |
esac | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment