Emil Breding | 86f59a5 | 2012-04-25 21:58:33 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # Bash Maven completion |
| 3 | |
| 4 | _mvn() |
| 5 | { |
| 6 | local cmds cur colonprefixes |
| 7 | cmds="clean validate compile test package integration-test \ |
| 8 | verify install deploy test-compile site generate-sources \ |
| 9 | process-sources generate-resources process-resources \ |
| 10 | eclipse:eclipse eclipse:add-maven-repo eclipse:clean \ |
| 11 | idea:idea -DartifactId= -DgroupId= -Dmaven.test.skip=true \ |
| 12 | -Declipse.workspace= -DarchetypeArtifactId= \ |
| 13 | netbeans-freeform:generate-netbeans-project \ |
| 14 | tomcat:run tomcat:run-war tomcat:deploy jboss-as:deploy \ |
| 15 | versions:display-dependency-updates \ |
| 16 | versions:display-plugin-updates dependency:analyze \ |
| 17 | dependency:analyze-dep-mgt dependency:resolve \ |
| 18 | dependency:sources dependency:tree release:prepare \ |
| 19 | release:rollback release:perform --batch-mode" |
| 20 | |
| 21 | COMPREPLY=() |
| 22 | cur=${COMP_WORDS[COMP_CWORD]} |
| 23 | # Work-around bash_completion issue where bash interprets a colon |
| 24 | # as a separator. |
| 25 | # Work-around borrowed from the darcs work-around for the same |
| 26 | # issue. |
| 27 | colonprefixes=${cur%"${cur##*:}"} |
| 28 | COMPREPLY=( $(compgen -W '$cmds' -- $cur)) |
| 29 | local i=${#COMPREPLY[*]} |
| 30 | while [ $((--i)) -ge 0 ]; do |
| 31 | COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"} |
| 32 | done |
| 33 | |
| 34 | return 0 |
| 35 | } && |
| 36 | complete -F _mvn mvn |