Permalink
Browse files

Added autocomplete for "usemvn" function.

  • Loading branch information...
1 parent 1673db9 commit 0cdfab9bf6057f16f5540bda2bf19f82b44047fb @nwinkler nwinkler committed Nov 19, 2012
Showing with 26 additions and 1 deletion.
  1. +26 −1 plugins/available/maven.plugin.bash
View
27 plugins/available/maven.plugin.bash
@@ -40,4 +40,29 @@ usemvn ()
fi
export MAVEN_HOME=$MAVEN_INSTALL_ROOT/apache-maven-$1
fi
-}
+}
+
+_usemvn-comp()
+{
+ local cur
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+
+ if [ -z "$MAVEN_INSTALL_ROOT" ]
+ then
+ local MAVEN_INSTALL_ROOT="/usr/local"
+ fi
+
+ local mvn_versions=$(for i in $MAVEN_INSTALL_ROOT/apache-maven-* ;
+ do
+ if [ -x "$i/bin/mvn" ]; then
+ basename $i | sed 's/^apache-maven-//'
+ fi
+ done)
+
+ COMPREPLY=( $(compgen -W "${mvn_versions}" -- ${cur}) )
+
+ return 0
+}
+
+complete -F _usemvn-comp usemvn

0 comments on commit 0cdfab9

Please sign in to comment.