PR: MPSHELL-1

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@190086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett
2005-06-11 06:55:23 +00:00
parent ecc2cd9e42
commit 155506715e
4 changed files with 68 additions and 3 deletions

View File

@@ -114,4 +114,28 @@ case "$state" in
</goal>
<goal name="shell:bash"
description="Generate Bash completion files">
<j:set var="mavenSession" value="${context.getMavenSession()}"/>
<j:set var="allGoals" value="${mavenSession.getAllGoalNames()}"/>
<j:new var="modList" className="java.util.ArrayList"/>
<j:set var="dummy" value="${modList.addAll(allGoals)}"/>
<j:invokeStatic method="sort" className="java.util.Collections" var="dummy">
<j:arg type="java.util.List" value="${modList}" />
</j:invokeStatic>
<j:file name="${maven.build.dir}/maven_goals.bash.tmp" omitXmlDeclaration="true" xmlns="dummy">
<j:forEach var="goal" items="${modList.iterator()}">
<j:whitespace>${goal}
</j:whitespace>
</j:forEach>
</j:file>
<copy file="${maven.build.dir}/maven_goals.bash.tmp" tofile="${maven.build.dir}/maven_goals.bash"/>
<delete file="${maven.build.dir}/maven_goals.bash.tmp"/>
</goal>
</project>

View File

@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-shell-plugin</id>
<name>Maven Shell Plug-in</name>
<currentVersion>1.1</currentVersion>
<currentVersion>1.2-SNAPSHOT</currentVersion>
<description>A plugin to generate various files for different shells to allow tab completion for maven goals</description>
<shortDescription>Shell Plugin for Maven</shortDescription>
<url>http://maven.apache.org/reference/plugins/shell/</url>

View File

@@ -24,6 +24,9 @@
<author email="apache@kav.dk">Kasper Nielsen</author>
</properties>
<body>
<release version="1.2-SNAPSHOT" date="in SVN">
<action dev="brett" type="update" due-to="Michael Schuerig" issue="MPSHELL-1">Bash completion support</action>
</release>
<release version="1.1" date="2004-03-10">
<action dev="dion" type="fix">Apply MAVEN-850</action>
</release>

View File

@@ -25,10 +25,10 @@
</properties>
<body>
<section name="Maven Eclipse Plugin">
<section name="Maven Shell Plugin">
<p>
This plug-in provides the ability to generate shell script files
that allows for tab completion.
that allows for tab completion.
</p>
<p>
For more information on the functionality provided by this plugin,
@@ -39,6 +39,44 @@
by this plugin, please see the <a href="properties.html">properties</a>
document.
</p>
<subsection name="Bash Completion">
<p>
You must add this to your <code>bash_completion.d</code> directory:
</p>
<source><![CDATA[
have maven &&
_maven() {
cf=target/maven_goals.bash
cur=${COMP_WORDS[$COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-D|--define|-d|--dir|-f|--find|-p|--pom)
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $(compgen -W '--debug --define --dir --emacs \
--exception --find --goals --help --info --nobanner \
--offline --plugin-help --pom --quiet --usage --version \
-D -E -P -X -b -d -e -f -g -h -i -o -p -q -u -v' -- $cur) )
return 0
fi
if [ ! -r "$cf" ] ; then
echo
echo "# The bash completion file does not exist or is not readable"
echo "# Please generate it with maven shell:bash"
return 0
fi
COMPREPLY=( $( cat "$cf" | grep "^$cur" ) )
}
[ "$have" ] && complete -F _maven maven
]]></source>
</subsection>
</section>
</body>
</document>