Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Ant Completion: Find targets recursively
- X-seq: zsh-workers 21693
- From: Jean-Baptiste Quenot <jb.quenot@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: [PATCH] Ant Completion: Find targets recursively
- Date: Fri, 2 Sep 2005 10:25:01 +0200
- In-reply-to: <20050827200547.ECB768664@xxxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Jean-Baptiste Quenot <jb.quenot@xxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <jb.quenot@xxxxxxxxxxx> <20050826121710.GA90620@xxxxxxxxxxxxxx> <20050827200547.ECB768664@xxxxxxxxxxxxxxxxxxxxxxxx>
* 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/
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/ *<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
+}
+
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/ *<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
fi
else
_message -e targets target
Messages sorted by:
Reverse Date,
Date,
Thread,
Author