mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 15:53:22 +01:00
feat(gradle): update completion from upstream (#11485)
This commit is contained in:
parent
45571bfa03
commit
0e9e5360c4
@ -1,4 +1,3 @@
|
||||
#compdef gradle gradlew gw
|
||||
#
|
||||
# Taken from https://github.com/gradle/gradle-completion
|
||||
# Copyright (c) 2017 Eric Wendelin
|
||||
@ -22,6 +21,8 @@
|
||||
# SOFTWARE.
|
||||
# Terms
|
||||
|
||||
#compdef gradle gradlew gw
|
||||
|
||||
__gradle-set-project-root-dir() {
|
||||
local dir=`pwd`
|
||||
project_root_dir=`pwd`
|
||||
@ -96,7 +97,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 | grep -E -v "$script_exclude_pattern") )
|
||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
|
||||
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
||||
fi
|
||||
}
|
||||
@ -116,9 +117,9 @@ __gradle-generate-tasks-cache() {
|
||||
# Reuse Gradle Daemon if IDLE but don't start a new one.
|
||||
local gradle_tasks_output
|
||||
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
|
||||
gradle_tasks_output="$($gradle_cmd --daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
|
||||
gradle_tasks_output="$($gradle_cmd --daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
|
||||
else
|
||||
gradle_tasks_output="$($gradle_cmd --no-daemon --build-file $gradle_build_file --console plain -q tasks --all 2>/dev/null)"
|
||||
gradle_tasks_output="$($gradle_cmd --no-daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
|
||||
fi
|
||||
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
|
||||
local -a match
|
||||
@ -180,7 +181,7 @@ __gradle_tasks() {
|
||||
local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
|
||||
local -a cached_tasks
|
||||
if [[ -z $cur ]]; then
|
||||
cached_tasks=(${(f)"$(cat $cache_dir/$cached_checksum)"})
|
||||
cached_tasks=(${(f)"$(grep -v "^\\\:" $cache_dir/$cached_checksum)"})
|
||||
else
|
||||
cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
|
||||
fi
|
||||
@ -191,7 +192,7 @@ __gradle_tasks() {
|
||||
|
||||
# Regenerate tasks cache in the background
|
||||
if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
|
||||
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
|
||||
$(__gradle-generate-tasks-cache &> /dev/null &)
|
||||
fi
|
||||
else
|
||||
_describe 'built-in tasks' '(
|
||||
@ -262,7 +263,10 @@ __gradle_subcommand() {
|
||||
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
|
||||
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
|
||||
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
|
||||
'(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
|
||||
'--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
|
||||
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
|
||||
'(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
|
||||
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
|
||||
'--continue[Continues task execution after a task failure.]' \
|
||||
'-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
|
||||
@ -276,6 +280,7 @@ __gradle_subcommand() {
|
||||
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
|
||||
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
|
||||
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
|
||||
'-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
|
||||
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
|
||||
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
|
||||
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
|
||||
@ -314,6 +319,7 @@ __gradle_subcommand() {
|
||||
'(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
|
||||
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
|
||||
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
|
||||
'(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
|
||||
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
|
||||
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
|
||||
;;
|
||||
@ -347,6 +353,9 @@ _gradle() {
|
||||
{-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
|
||||
{-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
|
||||
{-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
|
||||
'(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
|
||||
'(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
|
||||
'--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
|
||||
'(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
|
||||
'--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
|
||||
'--continue[Continues task execution after a task failure.]' \
|
||||
@ -361,6 +370,7 @@ _gradle() {
|
||||
'-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
|
||||
'-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
|
||||
'-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
|
||||
'-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
|
||||
'-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
|
||||
'-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
|
||||
'(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
|
||||
@ -404,6 +414,7 @@ _gradle() {
|
||||
'(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
|
||||
'--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
|
||||
'(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
|
||||
'(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
|
||||
{-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
|
||||
'(-)*:: :->task-or-option' && ret=0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user