zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: further support for <import>s in ant completion
@ 2005-02-25 14:05 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2005-02-25 14:05 UTC (permalink / raw)
  To: Zsh workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-25 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-25 14:05 PATCH: further support for <import>s in ant completion Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).