summaryrefslogtreecommitdiff
path: root/plugins/mvn/mvn.plugin.zsh
diff options
context:
space:
mode:
authorJanosch Schwalm <janosch.schwalm@gmail.com>2018-08-29 21:00:06 +0200
committerRobby Russell <robby@planetargon.com>2018-08-29 12:00:06 -0700
commit3cd8eaf9bb1382ff4f35e614904a4f16553e0dcb (patch)
treed45d4ca5bab60f24efff2ed6ad371bf91f756a90 /plugins/mvn/mvn.plugin.zsh
parent84aa274604f33bf440df81fbe73543b072018d47 (diff)
downloadzsh-3cd8eaf9bb1382ff4f35e614904a4f16553e0dcb.tar.gz
zsh-3cd8eaf9bb1382ff4f35e614904a4f16553e0dcb.tar.bz2
zsh-3cd8eaf9bb1382ff4f35e614904a4f16553e0dcb.zip
execute mvnw with "mvn" when mvnw-file is present (#6484)
* executing mvnw, when mvnw-file exists indriectly enable autocompletion for mvnw * inform the user :)
Diffstat (limited to 'plugins/mvn/mvn.plugin.zsh')
-rw-r--r--plugins/mvn/mvn.plugin.zsh14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index d422ba5c7..74583c6dc 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -20,6 +20,15 @@ BACKGROUND_CYAN=$(tput setab 6)
BACKGROUND_WHITE=$(tput setab 7)
RESET_FORMATTING=$(tput sgr0)
+# if found a ./mvnw file execute it otherwise execute orignal mvn
+mvn-or-mvnw() {
+ if [ -f ./mvnw ] ; then
+ echo "executing mvnw instead of mvn"
+ ./mvnw "$@";
+ else
+ mvn "$@";
+ fi
+}
# Wrapper function for Maven's mvn command.
mvn-color() {
@@ -40,6 +49,9 @@ mvn-color() {
# Override the mvn command with the colorized one.
#alias mvn="mvn-color"
+# either use orignal mvn oder the mvn wrapper
+alias mvn="mvn-or-mvnw"
+
# aliases
alias mvncie='mvn clean install eclipse:eclipse'
alias mvnci='mvn clean install'
@@ -276,3 +288,5 @@ function listMavenCompletions {
}
compctl -K listMavenCompletions mvn
+compctl -K listMavenCompletions mvn-or-mvnw
+