.bash_completion.d/gradle
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 13 Jan 2020 14:00:42 +0200
changeset 936 7c8a97e5273d
parent 933 8df13eb76a24
child 938 9e7576e732d6
permissions -rw-r--r--
Added completion for --console Gradle option.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
643
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
# -*- mode: sh; sh-shell-file: bash -*-
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     3
_gradle_cmd()
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     4
{
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
     5
  for ((i = 1; i < $COMP_CWORD; i += 1)); do
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     6
    case "${COMP_WORDS[i]}" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     7
      -*) continue ;;
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     8
      *" "*) continue ;;
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
     9
    esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    10
    echo "${COMP_WORDS[i]}"
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    11
    return
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    12
  done
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    13
}
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    14
643
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
_gradle()
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
{
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    17
  local OIFS=$IFS
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    18
  local _opts="-? -h --help -A --dep-tasks -C --cache -D --system-prop -I --init-script -P --project-prop -S --full-stacktrace -a --no-rebuild --all \
645
51f6d81be3da Update options according to "gradle --help" with v1.4.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
    19
     -b --build-file -c --settings-file -d --debug -e --embedded -g --gradle-user-home --gui -i --info -m --dry-run --no-opt -p --project-dir \
51f6d81be3da Update options according to "gradle --help" with v1.4.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
    20
     -q --quiet -r --properties -s --stacktrace -t --tasks -u --no-search-upward -v --version -x --exclude-task \
893
3cb881498907 Added support for --include-build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 867
diff changeset
    21
     --continue --foreground --no-color --project-cache-dir --include-build --recompile-scripts --refresh --refresh-dependencies \
923
fa297b1cbc0b Added --fail-fast option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 907
diff changeset
    22
     --fail-fast \
936
7c8a97e5273d Added completion for --console Gradle option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
    23
     --console \
923
fa297b1cbc0b Added --fail-fast option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 907
diff changeset
    24
     --daemon --no-daemon --offline --build-cache --parallel --parallel-threads --profile --status \
645
51f6d81be3da Update options according to "gradle --help" with v1.4.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
    25
     --rerun-tasks --stop"
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    26
  local _application_cmds='run startScripts installApp distZip distTar'
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    27
  declare -a _extra
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    28
  local cur prev
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    29
  cur=${COMP_WORDS[COMP_CWORD]}
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    30
  [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    31
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    32
  local _tasks_full='help - Displays a help message.
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    33
wrapper - Create ./gradlew.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    34
assemble - Assembles the outputs of this project.
907
e8259d7d8e3a bootRepackage was renamed to bootJar in modern Spring Boot Gradle plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 893
diff changeset
    35
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    36
build - Assembles and tests this project.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    37
buildDependents - Assembles and tests this project and all projects that depend on it.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    38
buildNeeded - Assembles and tests this project and all projects it depends on.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    39
classes - Assembles main classes.
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    40
compileJava - Compile src/main/java.
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    41
compileTestJava - Compile src/test/java.
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    42
processResources - Process src/main/resources.
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    43
processTestResources - Process src/test/resources.
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    44
uploadArchives - Deploy build to repository.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    45
clean - Deletes the build directory.
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    46
cleanTest - Delete tests.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    47
jar - Assembles a jar archive containing the main classes.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    48
testClasses - Assembles test classes.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    49
buildEnvironment - Displays all buildscript dependencies.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    50
components - Displays the components.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    51
dependencies - Displays all dependencies.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    52
dependencyInsight - Displays the insight into a specific dependency.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    53
model - Displays the configuration model.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    54
projects - Displays the sub-projects.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    55
properties - Displays the properties.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    56
tasks - Displays the tasks runnable from project.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    57
cleanIdea - Cleans IDEA project files (IML, IPR)
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    58
idea - Generates IDEA project files (IML, IPR, IWS)
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    59
check - Runs all checks.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    60
test - Runs the unit tests.
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    61
init - Generate basic Gradle project files.
843
50ca934b19e6 Simplify syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 842
diff changeset
    62
install - Installs the archives artifacts into the local Maven repository.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    63
javadoc - Generates Javadoc API documentation for the main source code.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    64
bootRun - Run the project with support for auto-detecting main class and reloading static resources
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    65
flywayBaseline - Baselines an existing database, excluding all migrations up to and including baselineVersion.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    66
flywayClean - Drops all objects in the configured schemas.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    67
flywayInfo - Prints the details and status information about all the migrations.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    68
flywayMigrate - Migrates the schema to the latest version.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    69
flywayRepair - Repairs the Flyway metadata table.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    70
flywayValidate - Validate applied migrations against resolved ones'
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    71
  IFS=$'\n'
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    72
  local _tasks=( $_tasks_full )
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    73
  IFS=$' \n'
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    74
  _tasks=( ${_tasks[@]%% -*} )
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    75
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    76
  if [[ $COMP_CWORD = 1 ]] && [[ "$cur" != -* ]]; then
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    77
      IFS=$'\n'
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    78
      COMPREPLY=( $(compgen -W '${_tasks_full}' -- "$cur") )
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    79
      if [[ ${#COMPREPLY[@]} -le 1 ]]; then
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    80
          COMPREPLY=( ${COMPREPLY[0]%% *-*} )
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    81
      fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    82
      IFS=$OIFS; return
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    83
  fi
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    84
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    85
  # Perform default option completion for command.
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    86
  if [[ -z "$curr" ]]; then
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    87
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    88
        help)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    89
          COMPREPLY=( --task )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    90
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    91
        init)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    92
          COMPREPLY=( --type )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    93
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    94
        wrapper)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    95
          COMPREPLY=( --gradle-version )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    96
          IFS=$OIFS; return ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
    97
        dependencies|dependencyInsight)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    98
          COMPREPLY=( --configuration )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    99
          IFS=$OIFS; return ;;
936
7c8a97e5273d Added completion for --console Gradle option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
   100
        --console)
7c8a97e5273d Added completion for --console Gradle option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
   101
          COMPREPLY=( $(compgen -W "auto plain rich verbose" -- "$cur") )
7c8a97e5273d Added completion for --console Gradle option.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
   102
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   103
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   104
  fi
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   105
933
8df13eb76a24 Added link to Gradle configuration config docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 932
diff changeset
   106
  # https://docs.gradle.org/current/userguide/java_library_plugin.html
932
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   107
  # configurations.each { println it.name + " - " + it.description }
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   108
  local _configs="annotationProcessor     - Annotation processors and their dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   109
api                     - API dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   110
apiElements             - API elements for main.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   111
archives                - Configuration for archive artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   112
bootArchives            - Configuration for Spring Boot archive artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   113
compile                 - Dependencies for source set 'main' (deprecated, use 'implementation' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   114
compileClasspath        - Compile classpath for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   115
compileOnly             - Compile only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   116
default                 - Configuration for default artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   117
implementation          - Implementation only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   118
runtime                 - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   119
runtimeClasspath        - Runtime classpath of source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   120
runtimeElements         - Elements of runtime for main.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   121
runtimeOnly             - Runtime only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   122
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   123
testCompile             - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   124
testCompileClasspath    - Compile classpath for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   125
testCompileOnly         - Compile only dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   126
testImplementation      - Implementation only dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   127
testRuntime             - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   128
testRuntimeClasspath    - Runtime classpath of source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   129
testRuntimeOnly         - Runtime only dependencies for source set 'test'."
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   130
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   131
  # Add or perform command specific completion.
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   132
  local _cmd=$(_gradle_cmd)
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   133
  case "$_cmd" in
829
ccd4c8b35330 Improve completion for help task.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 827
diff changeset
   134
    help)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   135
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   136
        --task)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   137
          COMPREPLY=( $(compgen -W '${_tasks[@]} $_application_cmds'  -- $cur) )
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   138
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   139
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   140
      _extra+=( --task )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   141
      ;;
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   142
    init)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   143
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   144
        --type)
866
be65947cc359 Added additional ``init`` plugin supported types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 865
diff changeset
   145
          COMPREPLY=( $(compgen -W "basic groovy-library java-library pom scala-library java-application groovy-application" -- "$cur") )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   146
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   147
        --test-framework)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   148
          COMPREPLY=( $(compgen -W "spock testng" -- "$cur") )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   149
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   150
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   151
      _extra+=( --type --test-framework )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   152
      ;;
833
490674629971 Add wrapper task.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 832
diff changeset
   153
    wrapper)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   154
      _extra+=( --gradle-version )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   155
      ;;
835
b2e3e02b9259 Completion for "dependencies --configuration".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 833
diff changeset
   156
    dependencies)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   157
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   158
        --configuration)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   159
          IFS=$'\n'
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   160
          COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   161
          if [[ ${#COMPREPLY[@]} -le 1 ]]; then
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   162
              COMPREPLY=( ${COMPREPLY[0]%% *-*} )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   163
          fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   164
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   165
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   166
      _extra+=( --configuration )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   167
      ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   168
    dependencyInsight)
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   169
      case "$prev" in
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   170
        --configuration)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   171
          IFS=$'\n'
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   172
          COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   173
          if [[ ${#COMPREPLY[@]} -le 1 ]]; then
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   174
              COMPREPLY=( ${COMPREPLY[0]%% *-*} )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   175
          fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   176
          IFS=$OIFS; return ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   177
      esac
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   178
      _extra+=( --configuration --dependency )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   179
      ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   180
  esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   181
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   182
  # Perform generic completion.
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   183
  case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   184
    -I|--init-script|-b|--build-file|-c|--settings-file|-e|--embedded)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   185
      COMPREPLY=( $(compgen -f -- "$cur") )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   186
      IFS=$OIFS; return ;;
893
3cb881498907 Added support for --include-build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 867
diff changeset
   187
    -g|--gradle-user-home|-p|--project-dir|--project-cache-dir|--include-build)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   188
      COMPREPLY=( $(compgen -d -- "$cur") )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   189
      IFS=$OIFS; return ;;
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
   190
  esac
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   191
  local _repl=( ${_extra[@]} ${_tasks[@]} $_application_cmds )
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   192
  COMPREPLY=( $(compgen -W '${_repl[@]} $_opts' -- $cur) )
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   193
  compopt +o nospace
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   194
  IFS=$OIFS
643
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   195
} &&
867
33ef236a0dd5 Enable completion for ../gradlew
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 866
diff changeset
   196
    complete -F _gradle gradle ./gradlew ../gradlew