Ant Bash Tab Completion with *nux (or cygwin)

I’ve seen at least one development computer set up like this, but otherwise I haven’t come across this technique before. Ant comes with a perl script that extends bash’s tab completion feature. You just need to add this line to your .bashrc file (for cygwin):

complete -C complete-ant-cmd.pl ant

Then, when you’re in a directory with a build.xml file, typing ant and then pressing tab will show you the available build targets. You can also enter the first letter of a known target, then tab, and only the targets starting with that letter will be shown. It works just the same as the regular tab completion, similar to commands like ls, for example.

This isn’t useful if you run ant builds from eclipse, but for command-line diehards like me that can never seem to remember the exact target name, it will save a lot of time.

I got the information from this post (which also references instructions for linux):

http://marius.scurtescu.com/2005/03/23/ant_bash_completion

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply