Completion for dependencyInsight. Fix for _extra expansion.
--- a/.bash_completion.d/gradle Sun Feb 26 10:00:54 2017 +0200
+++ b/.bash_completion.d/gradle Wed Mar 01 15:43:10 2017 +0200
@@ -2,7 +2,7 @@
_gradle_cmd()
{
- for ((i = $COMP_CWORD - 1; i > 0; i -= 1)); do
+ for ((i = 1; i < $COMP_CWORD; i += 1)); do
case "${COMP_WORDS[i]}" in
-*) continue ;;
*" "*) continue ;;
@@ -41,15 +41,28 @@
wrapper)
COMPREPLY=( --gradle-version )
return ;;
- dependencies)
+ dependencies|dependencyInsight)
COMPREPLY=( --configuration )
return ;;
esac
fi
+ local _configs="archives - Configuration for archive artifacts.
+compile - Compile time dependencies.
+compileClasspath - Compile classpath, used when compiling source.
+compileOnly - Compile time only dependencies, not used at runtime.
+default - Dependencies required by this project at runtime.
+optional -
+provided -
+runtime - Runtime dependencies for source set 'main'.
+testCompile - Dependencies for source set 'test'.
+testCompileClasspath - Compile classpath for source set 'test'.
+testCompileOnly - Compile dependencies for source set 'test'.
+testRuntime - Runtime dependencies for source set 'test'."
+
# Add or perform command specific completion.
- local cmd="$(_gradle_cmd)"
- case "$cmd" in
+ local _cmd=$(_gradle_cmd)
+ case "$_cmd" in
help)
case "$prev" in
--task)
@@ -75,18 +88,6 @@
dependencies)
case "$prev" in
--configuration)
- local _configs="archives - Configuration for archive artifacts.
-compile - Compile time dependencies.
-compileClasspath - Compile classpath, used when compiling source.
-compileOnly - Compile time only dependencies, not used at runtime.
-default - Dependencies required by this project at runtime.
-optional -
-provided -
-runtime - Runtime dependencies for source set 'main'.
-testCompile - Dependencies for source set 'test'.
-testCompileClasspath - Compile classpath for source set 'test'.
-testCompileOnly - Compile dependencies for source set 'test'.
-testRuntime - Runtime dependencies for source set 'test'."
local IFS=$'\n'
COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
if [[ ${#COMPREPLY[@]} -le 1 ]]; then
@@ -96,6 +97,18 @@
esac
_extra+=( --configuration )
;;
+ dependencyInsight)
+ case "$prev" in
+ --configuration)
+ local IFS=$'\n'
+ COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
+ if [[ ${#COMPREPLY[@]} -le 1 ]]; then
+ COMPREPLY=( ${COMPREPLY[0]%% *-*} )
+ fi
+ return ;;
+ esac
+ _extra+=( --configuration --dependency )
+ ;;
esac
# Perform generic completion.
@@ -107,7 +120,7 @@
COMPREPLY=( $(compgen -d -- "$cur") )
return ;;
esac
- COMPREPLY=( $(compgen -W '$_extra $_opts $_help_cmds $_java_cmds $_application_cmds $_other_cmd' -- $cur) )
+ COMPREPLY=( $(compgen -W '${_extra[@]} $_opts $_help_cmds $_java_cmds $_application_cmds $_other_cmd' -- $cur) )
compopt +o nospace
} &&
complete -F _gradle gradle ./gradlew