Plugin that allows one to generate files that allows tab completion for maven goals for different shells, currently only zsh is supported
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78ef8686e8
commit
cf29b6508d
3
shell/.cvsignore
Normal file
3
shell/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
102
shell/plugin.jelly
Normal file
102
shell/plugin.jelly
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project xmlns:j="jelly:core"
|
||||
xmlns:test="test">
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- Generate Eclipse .project and .classpath files -->
|
||||
<!--==================================================================-->
|
||||
<goal name="shell"
|
||||
description="Generate Zsh files"
|
||||
/>
|
||||
|
||||
<goal name="shell:zsh"
|
||||
description="Generate Zsh files">
|
||||
|
||||
<j:set var="outputDir" value="${maven.shell.zsh.dir}"/>
|
||||
<j:if test="${empty outputDir}">
|
||||
<j:set var="outputDir" value="${maven.build.dir}"/>
|
||||
</j:if>
|
||||
|
||||
<j:file name="${maven.build.dir}/_mavenzsh.tmp" omitXmlDeclaration="true" xmlns="dummy">
|
||||
<![CDATA[
|
||||
#compdef maven
|
||||
case "$service" in
|
||||
|
||||
maven)
|
||||
_arguments -s \
|
||||
'-D[Define a system property]' \
|
||||
'-E[Produce logging information without adornments]' \
|
||||
'-X[Produce execution debug output]' \
|
||||
'-b[Suppress logo banner]' \
|
||||
'-d[Set effective working directory]' \
|
||||
'-e[Produce exception stack traces]' \
|
||||
'-f[Set project file and effective working directory by finding the project file]' \
|
||||
'-g[Display available goals]' \
|
||||
'-h[Display help information]' \
|
||||
'-i[Display system information]' \
|
||||
'-o[Build is happening offline]' \
|
||||
'-p[Set project file]:Project File:_files -g \*.xml' \
|
||||
'-v[Display version information]' \
|
||||
':Maven Goals:-@GREATER_THAN@mavengoals' \
|
||||
':destination directory:_files -/' @AMBERSAND@@AMBERSAND@ return 0
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
[[ -n "$state" ]] @AMBERSAND@@AMBERSAND@
|
||||
case "$state" in
|
||||
|
||||
mavengoals)
|
||||
tmp=(
|
||||
|
||||
]]>
|
||||
|
||||
<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:forEach var="goal" items="${modList.iterator()}">
|
||||
<j:set var="escgoal" value='${goal.replaceAll(":","\\:")}'/>
|
||||
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${maven.shell.zdh.nodesc = 'true'}">
|
||||
<j:set var="desc" value="${mavenSession.getGoalDescription(goal)}"/>
|
||||
<j:set var="escdesc" value='${desc.replaceAll(":","\\:")}'/>
|
||||
<j:set var="point" value="'"/>
|
||||
<j:set var="pointesc" value='"'/>
|
||||
<j:set var="escdesc" value='${escdesc.replaceAll(point,pointesc)}'/>
|
||||
'${escgoal}:${escdesc}'
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
'${escgoal}'
|
||||
</j:otherwise>
|
||||
</j:choose></j:forEach>
|
||||
|
||||
|
||||
<![CDATA[
|
||||
)
|
||||
_describe 'Maven Goals' tmp --
|
||||
;;
|
||||
|
||||
esac
|
||||
]]>
|
||||
</j:file>
|
||||
|
||||
<echo>Now start a new zsh shell</echo>
|
||||
|
||||
<filter token="AMBERSAND" value="&"/>
|
||||
<filter token="LESSER_THAN" value="<"/>
|
||||
<filter token="GREATER_THAN" value=">"/>
|
||||
<copy file="${maven.build.dir}/_mavenzsh.tmp" tofile="${outputDir}/_maven" filtering="true"/>
|
||||
<delete file="${maven.build.dir}/_mavenzsh.tmp"/>
|
||||
|
||||
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
11
shell/plugin.properties
Normal file
11
shell/plugin.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P L U G I N P R O P E R I E S
|
||||
# -------------------------------------------------------------------
|
||||
# Shell plugin.
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# Generate Eclipse external tools mappings for the specified goals.
|
||||
# This accepts two values: 'all' for all the goals,
|
||||
# and 'plugins' to generate only the plugins' default goals.
|
||||
# maven.shell.zsh.dir= /usr/zsh/functions
|
||||
maven.shell.zsh.nodesc = true
|
||||
7
shell/project.properties
Normal file
7
shell/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
maven.license.licenseFile=${basedir}/../../../LICENSE.txt
|
||||
|
||||
32
shell/project.xml
Normal file
32
shell/project.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-shell-plugin</id>
|
||||
<name>Maven Shell Plug-in</name>
|
||||
<currentVersion>1.0</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://jakarta.apache.org/turbine/maven/reference/plugins/shell/</url>
|
||||
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/shell/</siteDirectory>
|
||||
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven/src/plugins-build/shell/</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/src/plugins-build/shell/</url>
|
||||
</repository>
|
||||
|
||||
<developers>
|
||||
|
||||
<developer>
|
||||
<name>Kasper Nielsen</name>
|
||||
<id>knielsen</id>
|
||||
<email>apache@kav.dk</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
</project>
|
||||
16
shell/xdocs/changes.xml
Normal file
16
shell/xdocs/changes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="apache@kav.dk">Kasper Nielsen</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.0" date="2003-03-10">
|
||||
<action dev="knielsen" type="add">
|
||||
Initial release
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
28
shell/xdocs/goals.xml
Normal file
28
shell/xdocs/goals.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>ShellScript Plugin Goals</title>
|
||||
<author email="apache@kav.dk">Kasper Nielsen</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>sheel</name>
|
||||
<description>
|
||||
The default goal. This goal simply executes the
|
||||
<a href="#shell:zsh">shell:zsh</a> goal for now
|
||||
</description>
|
||||
</goal>
|
||||
|
||||
<goal>
|
||||
<name>shell:zsh</name>
|
||||
<description>
|
||||
Generates a <code>_maven</code> file for the ZSH shell
|
||||
</description>
|
||||
</goal>
|
||||
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
26
shell/xdocs/index.xml
Normal file
26
shell/xdocs/index.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven Shell Plugin</title>
|
||||
<author email="apache@kav.dk">Kasper Nielsen</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven Eclipse Plugin">
|
||||
<p>
|
||||
This plug-in provides the ability to generate shell script files
|
||||
that allows for tab completion.
|
||||
</p>
|
||||
<p>
|
||||
For more information on the functionality provided by this plugin,
|
||||
please see the <a href="goals.html">Goals</a> document.
|
||||
</p>
|
||||
<p>
|
||||
For more information on how to customise the functionality provided
|
||||
by this plugin, please see the <a href="properties.html">properties</a>
|
||||
document.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
shell/xdocs/navigation.xml
Normal file
16
shell/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Eclipse Plugin">
|
||||
|
||||
<title>Maven Eclipse Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="zsh" href="http://www.zsh.org/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
35
shell/xdocs/properties.xml
Normal file
35
shell/xdocs/properties.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Shell Properties</title>
|
||||
<author email="apache@kav.dk">Kasper Nielsen</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Shell Settings">
|
||||
<table>
|
||||
<tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td>maven.shell.zsh.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location of the <a href="http://www.eclipse.org">Zsh</a>
|
||||
function directory.
|
||||
<p>
|
||||
If this parameter is specified, the <a href="goals.html#shell:zsh">
|
||||
shell:zsh</a> goal will use it as the destination to copy the generated file.
|
||||
Otherwise it will be put into the build dir.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.shell.zsh.nodesc</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Do not generate descriptions for tab completion
|
||||
</td>
|
||||
</tr>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Loading…
x
Reference in New Issue
Block a user