From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7291 invoked from network); 2 Sep 2005 08:25:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Sep 2005 08:25:18 -0000 Received: (qmail 61366 invoked from network); 2 Sep 2005 08:25:12 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Sep 2005 08:25:11 -0000 Received: (qmail 16627 invoked by alias); 2 Sep 2005 08:25:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21693 Received: (qmail 16618 invoked from network); 2 Sep 2005 08:25:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Sep 2005 08:25:06 -0000 Received: (qmail 60932 invoked from network); 2 Sep 2005 08:25:06 -0000 Received: from 195-13-58-165.oxyd.net (HELO caraldi.com) (195.13.58.165) by a.mx.sunsite.dk with SMTP; 2 Sep 2005 08:25:01 -0000 Received: from vision.anyware (10.21.96-84.rev.gaoland.net [84.96.21.10]) by caraldi.com (Postfix) with ESMTP id E4F63619E for ; Fri, 2 Sep 2005 10:25:00 +0200 (CEST) Received: by vision.anyware (Postfix, from userid 1021) id CDBBA613D; Fri, 2 Sep 2005 10:25:01 +0200 (CEST) Date: Fri, 2 Sep 2005 10:25:01 +0200 From: Jean-Baptiste Quenot To: zsh-workers@sunsite.dk Subject: Re: [PATCH] Ant Completion: Find targets recursively Message-ID: <20050902082501.GB40558@vision.anyware> Mail-Followup-To: Jean-Baptiste Quenot , zsh-workers@sunsite.dk References: <20050826121710.GA90620@vision.anyware> <20050827200547.ECB768664@pwstephenson.fsnet.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050827200547.ECB768664@pwstephenson.fsnet.co.uk> User-Agent: mutt-ng/devel-r445 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.0.4 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit * Peter Stephenson: > Jean-Baptiste Quenot wrote: > > > 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 clashes with an attempt to parse the output of ant to > do something or other, and will need to be resolved with what's > now in the CVS archive, unfortunately. Oh, that sounds interesting. How to use the new ant completion? Using ant -projecthelp to find targets is a good idea, but how to activate it: if zstyle -t ":completion:${curcontext}:targets" call-command; then Shall I set « zstyle :completion: » something? Anyway, for those not using this new code, please find attached an updated patch against zsh's CVS. -- Jean-Baptiste Quenot http://caraldi.com/jbq/ --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-zsh-ant-find-targets-head Index: _ant =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v retrieving revision 1.13 diff -u -r1.13 _ant --- _ant 8 Jun 2005 16:59:32 -0000 1.13 +++ _ant 2 Sep 2005 08:18:37 -0000 @@ -6,6 +6,18 @@ typeset -A opt_args local buildfile classpath cp userjars importedfiles target='*:target:->target' targets tmp +find_targets() { + importedfiles=( $(sed -n "s/ *]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) ) + targets=( $(sed -n "s/ *]* 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 +} + if [[ $service = *ANT_ARGS* ]]; then compset -q words=( fake "$words[@]" ) @@ -114,11 +126,7 @@ )//$'\015'}" _describe 'target' tmp && ret=0 else - importedfiles=( $(sed -n "s/ *]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $buildfile) ) - targets=( $(sed -n "s/ *]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $buildfile) ) - (( $#importedfiles )) && targets+=( $(cd $buildfile:h; - sed -n "s/ *]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $importedfiles) ) - _wanted targets expl target compadd -a targets && ret=0 + find_targets $buildfile fi else _message -e targets target --jRHKVT23PllUwdXP--