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

PATCH: further support for <import>s in ant completion



The following patch is an addition to Konstantin Sobolev's recent patch
for handling targets from imported files. Turns out that if the imported
files are specified using a relative pathname, that path is resolved
relative to the location of the original build.xml. The fix involves
using cd before sed in the subshell.

Imported files from imported files don't work but _ant has the
alternative method enabled with the call-command style. It isn't default
because it is too slow and, Konstantin tells me, ant -projecthelp only
lists targets with a description.

Oliver

Index: _ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.9
diff -u -r1.9 _ant
--- _ant	24 Feb 2005 17:06:00 -0000	1.9
+++ _ant	25 Feb 2005 10:10:48 -0000
@@ -88,8 +88,9 @@
       fi
       if [[ -f $buildfile ]]; then
         importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $buildfile) )
-        targets=( $(cat $buildfile $importedfiles |
-	    sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" ) )
+        targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $buildfile) )
+        (( $#importedfiles )) && targets+=( $(cd $buildfile:h;
+	    sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $importedfiles) )
 	_wanted targets expl target compadd -a targets && ret=0
       else
 	_message -e targets target



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