diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:17:48 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:17:48 +0200 |
commit | b09f4483416c54c1782824633dfabaf2ec0265b6 (patch) | |
tree | 304bc82642862525ae680c7fbaa249663b10ad57 /Completion/Unix/Command/_gradle | |
parent | 12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff) | |
parent | 6e55c920503071e917619b8cb1a188cd35d772db (diff) | |
download | zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip |
New upstream version 5.8.1.2-test
Diffstat (limited to 'Completion/Unix/Command/_gradle')
-rw-r--r-- | Completion/Unix/Command/_gradle | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle index 9a75daefb..a1d9381cb 100644 --- a/Completion/Unix/Command/_gradle +++ b/Completion/Unix/Command/_gradle @@ -1,9 +1,9 @@ #compdef gradle gradlew local curcontext="$curcontext" ret=1 state state_descr line -local gradle_inspect=yes cache_policy tag_order +local gradle_inspect=yes cache_policy tag_order filter= local -A opt_args -local -a gradle_group_tasks gradle_all_tasks +local -aU gradle_group_tasks gradle_all_tasks tasks # Set the caching policy to invalidate cache if the build file is newer than the cache. _gradle_caching_policy() { @@ -78,35 +78,57 @@ if [[ $words[CURRENT] != -* ]]; then local -a match mbegin mend # Run gradle/gradlew and retrieve possible tasks. for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do - if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then + # Subproject tasks are prefixed with one or more instances of [[:alnum:]]##\: + # Leaving out the prefix runs the task in all subprojects where it exists. + if [[ $outputline == + [[:blank:]]#(#b)([[:alnum:]]##\:)#([[:alnum:]]##)' - '(*) ]]; then # The descriptions of main tasks start at beginning of line, descriptions of # secondary tasks are indented. if [[ $outputline == [[:alnum:]]* ]]; then - gradle_group_tasks+=( "$match[1]:$match[2]" ) + gradle_group_tasks+=( + "$match[-2]:$match[-1]" + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) else - gradle_all_tasks+=( "$match[1]:$match[2]" ) + gradle_all_tasks+=( + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) fi fi done _store_cache $cache_name gradle_group_tasks gradle_all_tasks fi + filter= + zstyle -T ":completion:${curcontext}:tasks" prefix-needed && + [[ $PREFIX != ([[:alnum:]]##\:)## ]] && + filter+="*\:*" if [[ $state == task ]]; then _tags gradle_group gradle_all while _tags; do # Offer main tasks and secondary tasks in different tags. - _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0 - _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0 + if _requested gradle_group; then + tasks=( ${gradle_group_tasks:#$~filter} ) + _describe -t tasks 'group task' tasks && + ret=0 + fi + if _requested gradle_all; then + tasks=( ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'secondary task' tasks && + ret=0 + fi (( ret )) || break done elif [[ $state == alltask ]]; then # After '--exclude-task', we don't make a distinction between main tasks and # secondary tasks. - _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0 + tasks=( ${gradle_group_tasks:#$~filter} ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'task' tasks && + ret=0 fi fi else - _describe 'built-in tasks' '( + _describe 'built-in task' '( "dependencies:Displays all dependencies declared in root project." "dependencyInsight:Displays the insight into a specific dependency in root project." "help:Displays a help message." |