.bash_completion.d/gradle
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 29 Mar 2023 23:42:06 +0300
changeset 1018 831e2c1bf980
parent 1009 3f4f94c38069
permissions -rw-r--r--
Completed migration from ~/devel to ~/work.
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
955
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
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
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
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
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
    20
     -q --quiet -r --properties -s --stacktrace --warning-mode
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
    21
     -t --tasks -u --no-search-upward -v --version -x --exclude-task
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
    22
     --continue --foreground --no-color --project-cache-dir --include-build --recompile-scripts --refresh --refresh-dependencies
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
    23
     --fail-fast
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
    24
     --console
956
42ecad5e2cfe Replaced --parallel-threads with --max-workers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 955
diff changeset
    25
     --daemon --no-daemon --offline --build-cache --parallel --max-workers --profile --status
645
51f6d81be3da Update options according to "gradle --help" with v1.4.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
    26
     --rerun-tasks --stop"
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    27
  local _application_cmds='run startScripts installApp distZip distTar'
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    28
  declare -a _extra
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    29
  local cur prev
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
    30
  cur=${COMP_WORDS[COMP_CWORD]}
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    31
  [[ $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
    32
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    33
  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
    34
wrapper - Create ./gradlew.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    35
assemble - Assembles the outputs of this project.
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.
941
1b57d2d794d1 Added completion for Gradle 6.x java.withJavadocJar()/withSourcesJar().
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 940
diff changeset
    48
javadocJar - Assembles a jar archive containing the main javadoc.
1b57d2d794d1 Added completion for Gradle 6.x java.withJavadocJar()/withSourcesJar().
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 940
diff changeset
    49
sourcesJar - Assembles a jar archive containing the main sources.
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    50
testClasses - Assembles test classes.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    51
buildEnvironment - Displays all buildscript dependencies.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    52
components - Displays the components.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    53
dependencies - Displays all dependencies.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    54
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
    55
model - Displays the configuration model.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    56
projects - Displays the sub-projects.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    57
properties - Displays the properties.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    58
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
    59
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
    60
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
    61
check - Runs all checks.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    62
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
    63
init - Generate basic Gradle project files.
843
50ca934b19e6 Simplify syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 842
diff changeset
    64
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
    65
javadoc - Generates Javadoc API documentation for the main source code.
942
0715545658fd Added Artifactory related tasks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 941
diff changeset
    66
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
    67
bootRun - Run the project with support for auto-detecting main class and reloading static resources
954
2a197211653b Added publish task.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 953
diff changeset
    68
publish - Publishes all publications produced by this project
942
0715545658fd Added Artifactory related tasks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 941
diff changeset
    69
artifactoryDeploy - Deploys artifacts and build-info to Artifactory
0715545658fd Added Artifactory related tasks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 941
diff changeset
    70
artifactoryPublish - Adds artifacts and generates build-info to be later deployed to Artifactory
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    71
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
    72
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
    73
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
    74
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
    75
flywayRepair - Repairs the Flyway metadata table.
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    76
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
    77
  IFS=$'\n'
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    78
  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
    79
  IFS=$' \n'
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    80
  _tasks=( ${_tasks[@]%% -*} )
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    81
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    82
  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
    83
      IFS=$'\n'
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    84
      COMPREPLY=( $(compgen -W '${_tasks_full}' -- "$cur") )
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    85
      if [[ ${#COMPREPLY[@]} -le 1 ]]; then
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    86
          COMPREPLY=( ${COMPREPLY[0]%% *-*} )
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    87
      fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
    88
      IFS=$OIFS; return
842
4ab3110d3c9d Add command help if it is first argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 841
diff changeset
    89
  fi
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    90
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    91
  # Perform default option completion for command.
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    92
  if [[ -z "$curr" ]]; then
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    93
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    94
        help)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    95
          COMPREPLY=( --task )
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 ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    97
        init)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
    98
          COMPREPLY=( --type )
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 ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   100
        wrapper)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   101
          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
   102
          IFS=$OIFS; return ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   103
        dependencies|dependencyInsight)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   104
          COMPREPLY=( --configuration )
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   105
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   106
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   107
  fi
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   108
933
8df13eb76a24 Added link to Gradle configuration config docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 932
diff changeset
   109
  # https://docs.gradle.org/current/userguide/java_library_plugin.html
932
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   110
  # configurations.each { println it.name + " - " + it.description }
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   111
  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
   112
api                     - API dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   113
apiElements             - API elements for main.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   114
archives                - Configuration for archive artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   115
bootArchives            - Configuration for Spring Boot archive artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   116
compile                 - Dependencies for source set 'main' (deprecated, use 'implementation' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   117
compileClasspath        - Compile classpath for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   118
compileOnly             - Compile only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   119
default                 - Configuration for default artifacts.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   120
implementation          - Implementation only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   121
runtime                 - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   122
runtimeClasspath        - Runtime classpath of source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   123
runtimeElements         - Elements of runtime for main.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   124
runtimeOnly             - Runtime only dependencies for source set 'main'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   125
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   126
testCompile             - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   127
testCompileClasspath    - Compile classpath for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   128
testCompileOnly         - Compile only dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   129
testImplementation      - Implementation only dependencies for source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   130
testRuntime             - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead).
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   131
testRuntimeClasspath    - Runtime classpath of source set 'test'.
75fd41de9786 Updated available configurations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 923
diff changeset
   132
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
   133
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   134
  # Add or perform command specific completion.
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   135
  local _cmd=$(_gradle_cmd)
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   136
  case "$_cmd" in
829
ccd4c8b35330 Improve completion for help task.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 827
diff changeset
   137
    help)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   138
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   139
        --task)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   140
          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
   141
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   142
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   143
      _extra+=( --task )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   144
      ;;
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   145
    init)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   146
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   147
        --type)
866
be65947cc359 Added additional ``init`` plugin supported types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 865
diff changeset
   148
          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
   149
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   150
        --test-framework)
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   151
          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
   152
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   153
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   154
      _extra+=( --type --test-framework )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   155
      ;;
833
490674629971 Add wrapper task.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 832
diff changeset
   156
    wrapper)
953
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   157
      case "$prev" in
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   158
        --distribution-type)
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   159
          COMPREPLY=( $(compgen -W 'ALL BIN' -- "$cur") )
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   160
          return ;;
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   161
      esac
72ce83eeacc1 Added support for "wrapper --distribution-type ...".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 943
diff changeset
   162
      _extra+=( --gradle-version --distribution-type )
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   163
      ;;
835
b2e3e02b9259 Completion for "dependencies --configuration".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 833
diff changeset
   164
    dependencies)
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   165
      case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   166
        --configuration)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   167
          IFS=$'\n'
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   168
          COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   169
          if [[ ${#COMPREPLY[@]} -le 1 ]]; then
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   170
              COMPREPLY=( ${COMPREPLY[0]%% *-*} )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   171
          fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   172
          IFS=$OIFS; return ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   173
      esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   174
      _extra+=( --configuration )
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   175
      ;;
939
7a0bc8706152 Added "test" related Bash completions for Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 938
diff changeset
   176
    test)
940
1598b6de4108 Added --fail-fast to list of available options for Gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 939
diff changeset
   177
      COMPREPLY=( $(compgen -W "--fail-fast --continue --tests --rerun-tasks" -- "$cur") )
939
7a0bc8706152 Added "test" related Bash completions for Gradle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 938
diff changeset
   178
      IFS=$OIFS; return ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   179
    dependencyInsight)
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   180
      case "$prev" in
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   181
        --configuration)
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   182
          IFS=$'\n'
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   183
          COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   184
          if [[ ${#COMPREPLY[@]} -le 1 ]]; then
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   185
              COMPREPLY=( ${COMPREPLY[0]%% *-*} )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   186
          fi
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   187
          IFS=$OIFS; return ;;
841
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   188
      esac
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   189
      _extra+=( --configuration --dependency )
84ce0f420480 Completion for dependencyInsight. Fix for _extra expansion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
   190
      ;;
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   191
  esac
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   192
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   193
  # Perform generic completion.
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   194
  case "$prev" in
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   195
    -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
   196
      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
   197
      IFS=$OIFS; return ;;
893
3cb881498907 Added support for --include-build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 867
diff changeset
   198
    -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
   199
      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
   200
      IFS=$OIFS; return ;;
955
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   201
    --console)
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   202
      COMPREPLY=( $(compgen -W "auto plain rich verbose" -- "$cur") )
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   203
      IFS=$OIFS; return ;;
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   204
    --warning-mode)
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   205
      COMPREPLY=( $(compgen -W "all fail summary none" -- "$cur") )
5f3955ac75f3 Added completion for --console + --warning-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 954
diff changeset
   206
      IFS=$OIFS; return ;;
734
da0dc50393b6 Reindent sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
   207
  esac
844
f857121e545c Properly handle IFS to avoid polluting external value. Remove command lists,
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
   208
  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
   209
  COMPREPLY=( $(compgen -W '${_repl[@]} $_opts' -- $cur) )
839
e22ea617339d Add command sensitive completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
   210
  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
   211
  IFS=$OIFS
643
9f5ece28cd08 Add gradle completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   212
} &&
1009
3f4f94c38069 Defined completion for mygradle8 mygradle11 mygradle17.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 956
diff changeset
   213
    complete -F _gradle gradle gradlew mygradle mygradle8 mygradle11 mygradle17