Merge pull request #1952 from gaelicWizard/uncle

lib/helpers: new function `_bash-it-find-in-ancestor()`
This commit is contained in:
Noah Gorny
2021-09-28 16:51:30 +03:00
committed by GitHub
3 changed files with 33 additions and 23 deletions

View File

@@ -3,19 +3,10 @@ about-plugin 'Add a gw command to use gradle wrapper if present, else use system
function gw() {
local file="gradlew"
local curr_path="${PWD}"
local result="gradle"
local result
# Search recursively upwards for file.
until [[ "${curr_path}" == "/" ]]; do
if [[ -e "${curr_path}/${file}" ]]; then
result="${curr_path}/${file}"
break
else
curr_path=$(dirname "${curr_path}")
fi
done
result="$(_bash-it-find-in-ancestor "${file}")"
# Call gradle
"${result}" $*
"${result:-gradle}" $*
}