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
java, maven, zsh
One tweak would be to add
-name ‘*Test*’ to the find command. That will stuff non-test classes from showing up.
Try this one: https://github.com/zsh-users/zsh-completions/blob/master/_mvn