Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Ant Completion: Find targets recursively



Thank you for committing the patch:

----------------------------
revision 1.14
date: 2005/09/02 09:17:32;  author: pws;  state: Exp;  lines: +13 -5
21693: Jean-Baptiste Quenot: recursively find ant targets

However, there was an error in  this patch: it has the side effect
to change  current working directory when  build.xml imports files
from other directories.

Thanks to Philippe Gassmann for pointing out.

Please see patch attached.
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/
Index: _ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.14
diff -u -r1.14 _ant
--- _ant	2 Sep 2005 09:17:32 -0000	1.14
+++ _ant	5 Sep 2005 13:33:26 -0000
@@ -8,14 +8,13 @@
 
 find_targets() {
     importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
-    targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1) )
+    sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1
     if (( $#importedfiles )) ; then
-	cd $1:h
+	( cd $1:h
     	for file in $importedfiles ; do
 	    find_targets $file
-	done
+	done )
     fi
-    _wanted targets expl target compadd -a targets && ret=0
 }
 
 if [[ $service = *ANT_ARGS* ]]; then
@@ -126,7 +125,8 @@
         )//$'\015'}"
         _describe 'target' tmp && ret=0
       else
-        find_targets $buildfile
+        targets=( $(find_targets $buildfile) )
+        _wanted targets expl target compadd -a targets && ret=0
       fi
     else
       _message -e targets target


Messages sorted by: Reverse Date, Date, Thread, Author