Add enabled phases from current pom.xml for auto completion using BASH
----------------------------------------------------------------------
Key: MNGSITE-97
URL: http://jira.codehaus.org/browse/MNGSITE-97
Project: Maven 2 Project Web Site
Issue Type: Improvement
Reporter: Sylvain MOUQUET
Priority: Minor
I provide a new feature which get all enabled phases from the current pom.xml.
I don't read the parent pom or settings.xml because it's difficult to know
which parent pom is used, and the current configuration (profile activated,
...). And then it's a small tool, my goal was not corrupting the performance of
the bash
#!/bin/bash
_m2_make_goals()
{
plugin=$1
mojos=$2
for mojo in $mojos
do
export goals="$goals $plugin:$mojo"
done
}
_m2_add_phases()
{
for phase in `grep -i '<phase>' pom.xml | sed 's/<phase>\(.*\)<\/phase>/\1/i'`
do
export goals="$goals $phase"
done
}
_m2_complete()
{
local cur goals
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
if [ -f pom.xml ]; then
goals='clean compile test install package deploy site
help:effective-pom dependency:tree'
goals=$goals _m2_make_goals "eclipse" "eclipse"
goals=$goals _m2_add_phases
fi
COMPREPLY=($(compgen -W "${goals}" ${cur} | sed 's/\\\\//g') )
}
complete -F _m2_complete -o filenames mvn
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira