|
@@ -1,28 +1,4 @@
|
|
|
#compdef gradle gradlew gw
|
|
|
-# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
|
|
|
-
|
|
|
-#
|
|
|
-# Taken from https://github.com/gradle/gradle-completion
|
|
|
-# Copyright (c) 2017 Eric Wendelin
|
|
|
-#
|
|
|
-# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
-# this software and associated documentation files (the "Software"), to deal in
|
|
|
-# the Software without restriction, including without limitation the rights to
|
|
|
-# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
-# of the Software, and to permit persons to whom the Software is furnished to do
|
|
|
-# so, subject to the following conditions:
|
|
|
-#
|
|
|
-# The above copyright notice and this permission notice shall be included in all
|
|
|
-# copies or substantial portions of the Software.
|
|
|
-#
|
|
|
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
-# SOFTWARE.
|
|
|
-# Terms
|
|
|
|
|
|
__gradle-set-project-root-dir() {
|
|
|
local dir=`pwd`
|
|
@@ -38,7 +14,7 @@ __gradle-set-project-root-dir() {
|
|
|
}
|
|
|
|
|
|
__gradle-init-cache-dir() {
|
|
|
- cache_dir="$HOME/.gradle/completion"
|
|
|
+ cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
|
|
|
mkdir -p $cache_dir
|
|
|
}
|
|
|
|
|
@@ -98,7 +74,7 @@ __gradle-generate-script-cache() {
|
|
|
zle -R "Generating Gradle build script cache"
|
|
|
# Cache all Gradle scripts
|
|
|
local -a gradle_build_scripts
|
|
|
- gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
|
|
|
+ gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
|
|
|
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
|
|
fi
|
|
|
}
|
|
@@ -125,7 +101,7 @@ __gradle-generate-tasks-cache() {
|
|
|
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
|
|
|
local -a match
|
|
|
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
|
|
|
- if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
|
|
+ if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
|
|
local task_name="${match[1]}"
|
|
|
local task_description="${match[3]}"
|
|
|
# Completion for subproject tasks with ':' prefix
|