<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scala-fr &#187; Compilation</title>
	<atom:link href="http://www.scala-fr.org/tags/compilation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scala-fr.org</link>
	<description>communauté francophone autour du langage Scala</description>
	<lastBuildDate>Sat, 10 Oct 2009 08:01:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Complétion maven pour zsh</title>
		<link>http://www.scala-fr.org/completion-maven-pour-zsh/</link>
		<comments>http://www.scala-fr.org/completion-maven-pour-zsh/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 13:12:07 +0000</pubDate>
		<dc:creator>Maxime Biais</dc:creator>
				<category><![CDATA[Compilation]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[outils]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://www.scala-fr.org/?p=172</guid>
		<description><![CDATA[A ma grande déception zsh ne complète pas la commande maven. A force de taper des commandes mvn qqhcose, j&#8217;en avais assez, j&#8217;ai donc fait un petit script pour compléter les commandes que j&#8217;utilise le plus souvent avec maven et le plugin Scala :

function mainClasses &#123;
    if &#91; -d ./src &#93; ; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scala-fr.org%2Fcompletion-maven-pour-zsh%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scala-fr.org%2Fcompletion-maven-pour-zsh%2F" height="61" width="51" /></a></div><p>A ma grande déception zsh ne complète pas la commande maven. A force de taper des commandes <code>mvn qqhcose</code>, j&#8217;en avais assez, j&#8217;ai donc fait un petit script pour compléter les commandes que j&#8217;utilise le plus souvent avec maven et le plugin Scala :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> mainClasses <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> .<span style="color: #000000; font-weight: bold;">/</span>src <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>main <span style="color: #660033;">-type</span> f <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.scala&quot;</span>  <span style="color: #660033;">-o</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.java&quot;</span> \
             <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s?.*src/main/[^/]*/\(.*\)\..*?-DmainClass=\1?'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s+/+.+g'</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> mainTests <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> .<span style="color: #000000; font-weight: bold;">/</span>src <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">find</span> .<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*test*.scala&quot;</span>  <span style="color: #660033;">-o</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*test*.java&quot;</span>  \
             <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s?.*src/test/[^/]*/\(.*\)\..*?-Dtest=\1?'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s+/+.+g'</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> listMavenCompletions <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">reply</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>archetype:generate compile clean package <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #7a0874; font-weight: bold;">test</span>
    test-compile deploy release scala:run scala:<span style="color: #c20cb9; font-weight: bold;">cc</span>
    -Dmaven.test.skip=<span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #660033;">-DarchetypeCatalog</span>=http:<span style="color: #000000; font-weight: bold;">//</span>www.scala-tools.org<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #000000; font-weight: bold;">`</span>mainClasses<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">`</span>mainTests<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #660033;">-q</span> <span style="color: #660033;">-o</span>
    <span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
compctl <span style="color: #660033;">-K</span> listMavenCompletions mvn<span style="color: #000000; font-weight: bold;">%</span></pre></div></div>

<p>Le script n&#8217;est pas idéal mais il permet de compléter les commandes que j&#8217;utilise le plus souvent mais aussi les <code>-Dtest=</code> et <code>-DmainClass=</code> automatiquement en listant les fichiers de l&#8217;arborescence de votre projet. L&#8217;ideal serait d&#8217;avoir une option dans maven pour lister les commandes disponibles, mais ça n&#8217;existe pas à ma connaissance.</p>
<p>Si vous utilisez d&#8217;autres commandes maven, ajouter les dans la liste <code>reply</code> (séparer par des espaces ou saut de lignes).</p>
<p>Vous pouvez copier ce script dans votre <code>~/.zshrc</code>.</p>
     ]]></content:encoded>
			<wfw:commentRss>http://www.scala-fr.org/completion-maven-pour-zsh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
