.bash_completion.d/gradle
changeset 844 f857121e545c
parent 843 50ca934b19e6
child 845 f286f9ed6c0b
equal deleted inserted replaced
843:50ca934b19e6 844:f857121e545c
    12   done
    12   done
    13 }
    13 }
    14 
    14 
    15 _gradle()
    15 _gradle()
    16 {
    16 {
       
    17   local OIFS=$IFS
    17   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 \
    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 \
    18      -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 \
    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 \
    19      -q --quiet -r --properties -s --stacktrace -t --tasks -u --no-search-upward -v --version -x --exclude-task \
    20      -q --quiet -r --properties -s --stacktrace -t --tasks -u --no-search-upward -v --version -x --exclude-task \
    20      --continue --daemon --foreground --no-color --no-daemon --offline --parallel --parallel-threads --project-cache-dir --recompile-scripts --refresh --refresh-dependencies \
    21      --continue --daemon --foreground --no-color --no-daemon --offline --parallel --parallel-threads --project-cache-dir --recompile-scripts --refresh --refresh-dependencies \
    21      --rerun-tasks --stop"
    22      --rerun-tasks --stop"
    22   local _help_cmds='components dependencies dependencyInsight buildEnvironment help model projects properties tasks wrapper'
       
    23   local _java_cmds='assemble build buildDependents buildNeeded classes compileJava processResources cleanTest jar testClasses compileTestJava processTestResources \
       
    24      javadoc check test uploadArchives bootRun'
       
    25   local _application_cmds='run startScripts installApp distZip distTar'
    23   local _application_cmds='run startScripts installApp distZip distTar'
    26   local _other_cmd='clean init install interactive'
       
    27   declare -a _extra
    24   declare -a _extra
    28   local cur prev
    25   local cur prev
    29   cur=${COMP_WORDS[COMP_CWORD]}
    26   cur=${COMP_WORDS[COMP_CWORD]}
    30   [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
    27   [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
    31 
    28 
    32   local _tasks_full='help - Displays a help message.
    29   local _tasks_full='help - Displays a help message.
       
    30 wrapper - Create ./gradlew.
    33 assemble - Assembles the outputs of this project.
    31 assemble - Assembles the outputs of this project.
    34 bootRepackage - Repackage existing JAR and WAR archives so that they can be executed from the command line.
    32 bootRepackage - Repackage existing JAR and WAR archives so that they can be executed from the command line.
    35 build - Assembles and tests this project.
    33 build - Assembles and tests this project.
    36 buildDependents - Assembles and tests this project and all projects that depend on it.
    34 buildDependents - Assembles and tests this project and all projects that depend on it.
    37 buildNeeded - Assembles and tests this project and all projects it depends on.
    35 buildNeeded - Assembles and tests this project and all projects it depends on.
    38 classes - Assembles main classes.
    36 classes - Assembles main classes.
       
    37 compileJava - Compile src/main/java.
       
    38 compileTestJava - Compile src/test/java.
       
    39 processResources - Process src/main/resources.
       
    40 processTestResources - Process src/test/resources.
       
    41 uploadArchives - Deploy build to repository.
    39 clean - Deletes the build directory.
    42 clean - Deletes the build directory.
       
    43 cleanTest - Delete tests.
    40 jar - Assembles a jar archive containing the main classes.
    44 jar - Assembles a jar archive containing the main classes.
    41 testClasses - Assembles test classes.
    45 testClasses - Assembles test classes.
    42 buildEnvironment - Displays all buildscript dependencies.
    46 buildEnvironment - Displays all buildscript dependencies.
    43 components - Displays the components.
    47 components - Displays the components.
    44 dependencies - Displays all dependencies.
    48 dependencies - Displays all dependencies.
    45 dependencyInsight - Displays the insight into a specific dependency.
    49 dependencyInsight - Displays the insight into a specific dependency.
    46 help - Displays a help message.
       
    47 model - Displays the configuration model.
    50 model - Displays the configuration model.
    48 projects - Displays the sub-projects.
    51 projects - Displays the sub-projects.
    49 properties - Displays the properties.
    52 properties - Displays the properties.
    50 tasks - Displays the tasks runnable from project.
    53 tasks - Displays the tasks runnable from project.
    51 cleanIdea - Cleans IDEA project files (IML, IPR)
    54 cleanIdea - Cleans IDEA project files (IML, IPR)
    52 idea - Generates IDEA project files (IML, IPR, IWS)
    55 idea - Generates IDEA project files (IML, IPR, IWS)
    53 check - Runs all checks.
    56 check - Runs all checks.
    54 test - Runs the unit tests.
    57 test - Runs the unit tests.
       
    58 init - Generate basic Gradle project files.
    55 install - Installs the archives artifacts into the local Maven repository.
    59 install - Installs the archives artifacts into the local Maven repository.
    56 javadoc - Generates Javadoc API documentation for the main source code.
    60 javadoc - Generates Javadoc API documentation for the main source code.
    57 bootRun - Run the project with support for auto-detecting main class and reloading static resources
    61 bootRun - Run the project with support for auto-detecting main class and reloading static resources
    58 flywayBaseline - Baselines an existing database, excluding all migrations up to and including baselineVersion.
    62 flywayBaseline - Baselines an existing database, excluding all migrations up to and including baselineVersion.
    59 flywayClean - Drops all objects in the configured schemas.
    63 flywayClean - Drops all objects in the configured schemas.
    60 flywayInfo - Prints the details and status information about all the migrations.
    64 flywayInfo - Prints the details and status information about all the migrations.
    61 flywayMigrate - Migrates the schema to the latest version.
    65 flywayMigrate - Migrates the schema to the latest version.
    62 flywayRepair - Repairs the Flyway metadata table.
    66 flywayRepair - Repairs the Flyway metadata table.
    63 flywayValidate - Validate applied migrations against resolved ones'
    67 flywayValidate - Validate applied migrations against resolved ones'
       
    68   IFS=$'\n'
       
    69   local _tasks=( $_tasks_full )
       
    70   IFS=$' \n'
       
    71   _tasks=( ${_tasks[@]%% -*} )
    64 
    72 
    65   if [[ $COMP_CWORD = 1 ]] && [[ "$cur" != -* ]]; then
    73   if [[ $COMP_CWORD = 1 ]] && [[ "$cur" != -* ]]; then
    66       local IFS=$'\n'
    74       IFS=$'\n'
    67       COMPREPLY=( $(compgen -W '${_tasks_full}' -- "$cur") )
    75       COMPREPLY=( $(compgen -W '${_tasks_full}' -- "$cur") )
    68       if [[ ${#COMPREPLY[@]} -le 1 ]]; then
    76       if [[ ${#COMPREPLY[@]} -le 1 ]]; then
    69           COMPREPLY=( ${COMPREPLY[0]%% *-*} )
    77           COMPREPLY=( ${COMPREPLY[0]%% *-*} )
    70       fi
    78       fi
    71       return
    79       IFS=$OIFS; return
    72   fi
    80   fi
    73 
    81 
    74   # Perform default option completion for command.
    82   # Perform default option completion for command.
    75   if [[ -z "$curr" ]]; then
    83   if [[ -z "$curr" ]]; then
    76       case "$prev" in
    84       case "$prev" in
    77         help)
    85         help)
    78           COMPREPLY=( --task )
    86           COMPREPLY=( --task )
    79           return ;;
    87           IFS=$OIFS; return ;;
    80         init)
    88         init)
    81           COMPREPLY=( --type )
    89           COMPREPLY=( --type )
    82           return ;;
    90           IFS=$OIFS; return ;;
    83         wrapper)
    91         wrapper)
    84           COMPREPLY=( --gradle-version )
    92           COMPREPLY=( --gradle-version )
    85           return ;;
    93           IFS=$OIFS; return ;;
    86         dependencies|dependencyInsight)
    94         dependencies|dependencyInsight)
    87           COMPREPLY=( --configuration )
    95           COMPREPLY=( --configuration )
    88           return ;;
    96           IFS=$OIFS; return ;;
    89       esac
    97       esac
    90   fi
    98   fi
    91 
    99 
    92   local _configs="archives              - Configuration for archive artifacts.
   100   local _configs="archives              - Configuration for archive artifacts.
    93 compile               - Compile time dependencies.
   101 compile               - Compile time dependencies.
   106   local _cmd=$(_gradle_cmd)
   114   local _cmd=$(_gradle_cmd)
   107   case "$_cmd" in
   115   case "$_cmd" in
   108     help)
   116     help)
   109       case "$prev" in
   117       case "$prev" in
   110         --task)
   118         --task)
   111           COMPREPLY=( $(compgen -W '$_help_cmds $_java_cmds $_application_cmds $_other_cmd'  -- $cur) )
   119           echo ${_tasks[@]}
   112           return ;;
   120           COMPREPLY=( $(compgen -W '${_tasks[@]} $_application_cmds'  -- $cur) )
       
   121           IFS=$OIFS; return ;;
   113       esac
   122       esac
   114       _extra+=( --task )
   123       _extra+=( --task )
   115       ;;
   124       ;;
   116     init)
   125     init)
   117       case "$prev" in
   126       case "$prev" in
   118         --type)
   127         --type)
   119           COMPREPLY=( $(compgen -W "basic groovy-library java-library pom scala-library" -- "$cur") )
   128           COMPREPLY=( $(compgen -W "basic groovy-library java-library pom scala-library" -- "$cur") )
   120           return ;;
   129           IFS=$OIFS; return ;;
   121         --test-framework)
   130         --test-framework)
   122           COMPREPLY=( $(compgen -W "spock testng" -- "$cur") )
   131           COMPREPLY=( $(compgen -W "spock testng" -- "$cur") )
   123           return ;;
   132           IFS=$OIFS; return ;;
   124       esac
   133       esac
   125       _extra+=( --type --test-framework )
   134       _extra+=( --type --test-framework )
   126       ;;
   135       ;;
   127     wrapper)
   136     wrapper)
   128       _extra+=( --gradle-version )
   137       _extra+=( --gradle-version )
   129       ;;
   138       ;;
   130     dependencies)
   139     dependencies)
   131       case "$prev" in
   140       case "$prev" in
   132         --configuration)
   141         --configuration)
   133           local IFS=$'\n'
   142           IFS=$'\n'
   134           COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
   143           COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
   135           if [[ ${#COMPREPLY[@]} -le 1 ]]; then
   144           if [[ ${#COMPREPLY[@]} -le 1 ]]; then
   136               COMPREPLY=( ${COMPREPLY[0]%% *-*} )
   145               COMPREPLY=( ${COMPREPLY[0]%% *-*} )
   137           fi
   146           fi
   138           return ;;
   147           IFS=$OIFS; return ;;
   139       esac
   148       esac
   140       _extra+=( --configuration )
   149       _extra+=( --configuration )
   141       ;;
   150       ;;
   142     dependencyInsight)
   151     dependencyInsight)
   143       case "$prev" in
   152       case "$prev" in
   144         --configuration)
   153         --configuration)
   145           local IFS=$'\n'
   154           IFS=$'\n'
   146           COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
   155           COMPREPLY=( $(compgen -W '${_configs}' -- "$cur") )
   147           if [[ ${#COMPREPLY[@]} -le 1 ]]; then
   156           if [[ ${#COMPREPLY[@]} -le 1 ]]; then
   148               COMPREPLY=( ${COMPREPLY[0]%% *-*} )
   157               COMPREPLY=( ${COMPREPLY[0]%% *-*} )
   149           fi
   158           fi
   150           return ;;
   159           IFS=$OIFS; return ;;
   151       esac
   160       esac
   152       _extra+=( --configuration --dependency )
   161       _extra+=( --configuration --dependency )
   153       ;;
   162       ;;
   154   esac
   163   esac
   155 
   164 
   156   # Perform generic completion.
   165   # Perform generic completion.
   157   case "$prev" in
   166   case "$prev" in
   158     -I|--init-script|-b|--build-file|-c|--settings-file|-e|--embedded)
   167     -I|--init-script|-b|--build-file|-c|--settings-file|-e|--embedded)
   159       COMPREPLY=( $(compgen -f -- "$cur") )
   168       COMPREPLY=( $(compgen -f -- "$cur") )
   160       return ;;
   169       IFS=$OIFS; return ;;
   161     -g|--gradle-user-home|-p|--project-dir|--project-cache-dir)
   170     -g|--gradle-user-home|-p|--project-dir|--project-cache-dir)
   162       COMPREPLY=( $(compgen -d -- "$cur") )
   171       COMPREPLY=( $(compgen -d -- "$cur") )
   163       return ;;
   172       IFS=$OIFS; return ;;
   164   esac
   173   esac
   165   COMPREPLY=( $(compgen -W '${_extra[@]} $_opts $_help_cmds $_java_cmds $_application_cmds $_other_cmd' -- $cur) )
   174   local _repl=( ${_extra[@]} ${_tasks[@]} $_application_cmds )
       
   175   COMPREPLY=( $(compgen -W '${_repl[@]} $_opts' -- $cur) )
   166   compopt +o nospace
   176   compopt +o nospace
       
   177   IFS=$OIFS
   167 } &&
   178 } &&
   168     complete -F _gradle gradle ./gradlew
   179     complete -F _gradle gradle ./gradlew