# HG changeset patch # User Oleksandr Gavenko # Date 1488788526 -7200 # Node ID 4ab3110d3c9dd6ef75396c506ffbf7b56b009c2f # Parent 84ce0f420480e1cade57a7250bf0fefd8bb44118 Add command help if it is first argument. diff -r 84ce0f420480 -r 4ab3110d3c9d .bash_completion.d/gradle --- a/.bash_completion.d/gradle Wed Mar 01 15:43:10 2017 +0200 +++ b/.bash_completion.d/gradle Mon Mar 06 10:22:06 2017 +0200 @@ -27,7 +27,49 @@ declare -a _extra local cur prev cur=${COMP_WORDS[COMP_CWORD]} - [[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} + [[ $COMP_CWORD -gt 1 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} + + local _tasks_full='help - Displays a help message. +assemble - Assembles the outputs of this project. +bootRepackage - Repackage existing JAR and WAR archives so that they can be executed from the command line. +build - Assembles and tests this project. +buildDependents - Assembles and tests this project and all projects that depend on it. +buildNeeded - Assembles and tests this project and all projects it depends on. +classes - Assembles main classes. +clean - Deletes the build directory. +jar - Assembles a jar archive containing the main classes. +testClasses - Assembles test classes. +buildEnvironment - Displays all buildscript dependencies. +components - Displays the components. +dependencies - Displays all dependencies. +dependencyInsight - Displays the insight into a specific dependency. +help - Displays a help message. +model - Displays the configuration model. +projects - Displays the sub-projects. +properties - Displays the properties. +tasks - Displays the tasks runnable from project. +cleanIdea - Cleans IDEA project files (IML, IPR) +idea - Generates IDEA project files (IML, IPR, IWS) +check - Runs all checks. +test - Runs the unit tests. +install - Installs the 'archives' artifacts into the local Maven repository. +javadoc - Generates Javadoc API documentation for the main source code. +bootRun - Run the project with support for auto-detecting main class and reloading static resources +flywayBaseline - Baselines an existing database, excluding all migrations up to and including baselineVersion. +flywayClean - Drops all objects in the configured schemas. +flywayInfo - Prints the details and status information about all the migrations. +flywayMigrate - Migrates the schema to the latest version. +flywayRepair - Repairs the Flyway metadata table. +flywayValidate - Validate applied migrations against resolved ones' + + if [[ $COMP_CWORD = 1 ]] && [[ "$cur" != -* ]]; then + local IFS=$'\n' + COMPREPLY=( $(compgen -W '${_tasks_full}' -- "$cur") ) + if [[ ${#COMPREPLY[@]} -le 1 ]]; then + COMPREPLY=( ${COMPREPLY[0]%% *-*} ) + fi + return + fi # Perform default option completion for command. if [[ -z "$curr" ]]; then