zsh-workers
 help / color / mirror / code / Atom feed
From: Jean-Baptiste Quenot <jb.quenot@caraldi.com>
To: zsh-workers@sunsite.dk
Subject: [PATCH] Ant Completion: Find targets recursively
Date: Fri, 26 Aug 2005 14:17:12 +0200	[thread overview]
Message-ID: <20050826121710.GA90620@vision.anyware> (raw)

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

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/

[-- Attachment #2: patch-zsh-ant-find-targets --]
[-- Type: text/plain, Size: 1223 bytes --]

--- _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

             reply	other threads:[~2005-08-26 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-26 12:17 Jean-Baptiste Quenot [this message]
2005-08-27 20:05 ` Peter Stephenson
2005-09-02  8:25   ` Jean-Baptiste Quenot
2005-09-05 13:40     ` Jean-Baptiste Quenot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050826121710.GA90620@vision.anyware \
    --to=jb.quenot@caraldi.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).