Home > programming > Maven completion in zsh

Maven completion in zsh

To get mvn completion in zsh, add this to your .zshrc:

function listMavenCompletions { reply=(cli:execute cli:execute-phase archetype:generate compile clean install test test-compile deploy package cobertura:cobertura jetty:run -Dmaven.test.skip=true -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`); }
compctl -K listMavenCompletions mvn

It should complete the class names after ‘-Dtest=’, so that you can test one class at a time.

Advertisement
Categories: programming Tags: , ,
  1. 2010/05/07 at 6:39 am | #1

    One tweak would be to add

    -name ‘*Test*’ to the find command. That will stuff non-test classes from showing up.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.