Created
June 3, 2019 15:35
-
-
Save awood/58bc9ac8cf21567e7a37022cf936296b to your computer and use it in GitHub Desktop.
Zsh function to find gradlew by going up through parent directories
This file contains hidden or 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
#! /bin/zsh | |
gradleup() { | |
local curdir="$PWD" | |
while [[ "`pwd`" != "$HOME" && "`pwd`" != '/' ]]; do | |
if [[ -e gradlew ]]; then | |
local result=$(realpath ./gradlew) | |
break | |
fi | |
cd .. | |
done | |
cd "$curdir" | |
if [[ -v result ]]; then | |
eval "$result $@" | |
else | |
echo "gradlew not found" | |
fi | |
} | |
gradleup "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment