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

[PATCH] Ant Completion: Find targets recursively



Hello,

Thank you  very much for  providing support for imported  files in
Ant completion.  However, recursive handling of imported files was
not supported.   Please find attached  a patch that  adresses this
issue.

This patch is against zsh 4.2.5

Thanks in advance,
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/
--- _ant.orig	Wed Aug  3 10:51:03 2005
+++ _ant	Fri Aug 26 14:13:05 2005
@@ -14,6 +14,18 @@
   unset target
 fi
 
+find_targets() {
+    importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
+    targets=( $(sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1) )
+    if (( $#importedfiles )) ; then
+	cd $1:h
+    	for file in $importedfiles ; do
+	    find_targets $file
+	done
+    fi
+    _wanted targets expl target compadd -a targets && ret=0
+}
+
 _arguments -C \
   '-help[display usage information]' \
   '-projecthelp[print project help information]' \
@@ -87,11 +99,7 @@
 	buildfile=${(v)opt_args[(I)(-f|-file|-buildfile)]:-build.xml}
       fi
       if [[ -f $buildfile ]]; then
-        importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $buildfile) )
-        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
+        find_targets $buildfile
       else
 	_message -e targets target
       fi


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