A tab completion script that works for Bash. Relies on the BSD md5
command on Mac and md5sum
on Linux, so as long as you have one of those two commands, this should work.
$ gradle [TAB]
androidDependencies check init properties
assemble clean installDebug signingReport
assembleDebug connectedCheck installDebugTest tasks
assembleDebugTest connectedInstrumentTest installRelease uninstallAll
assembleRelease dependencies lint uninstallDebug
build dependencyInsight lintDebug uninstallDebugTest
buildDependents deviceCheck lintRelease uninstallRelease
buildNeeded help projects wrapper
$ gradle c[TAB]
check clean connectedCheck connectedInstrumentTest
Gives tab completions relevent to the current Gradle project (if any).
curl -L -s https://gist.github.com/nolanlawson/8694399/raw/gradle-tab-completion.bash \
-o ~/gradle-tab-completion.bash
Then add to your ~/.bash_profile
:
source ~/gradle-tab-completion.bash
It will be kinda slow the first time you use it. But after that, it'll be super fast, because everything's cached based on the md5sum of your build.gradle
files.
Thanks to @ligi for Linux support!
Since I use gradle a lot and the gist is a little outdated, I've cloned the project to Github, added testing to fix any bugs, and improved the caching to support multiple repos.
https://github.com/meonlol/gradle-tab-completion
I'll add all other proposed changes to make one super-hyper-compatible version:
[+] Mac & Linux support
[+] per-project caching
[+] support tasks without descriptions
[+] support all tasks with
--all
[+] since the tasks are local, we can go
--offline
[ ] gitbash & cygwin support
[ ] commandline flags support
[ ] module support