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

@@ -22,17 +22,9 @@
# Avoid inaccurate completions for subproject tasks
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
__gradle-set-project-root-dir() {
local dir="${PWD}"
project_root_dir="${PWD}"
while [[ $dir != '/' ]]; do
if [[ -f "$dir/settings.gradle" || -f "$dir/gradlew" ]]; then
project_root_dir=$dir
return 0
fi
dir="$(dirname "$dir")"
done
return 1
function __gradle-set-project-root-dir() {
project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
return "$?"
}
__gradle-init-cache-dir() {