* Patch for _ant
@ 2007-11-28 17:51 Kohsuke Kawaguchi
0 siblings, 0 replies; only message in thread
From: Kohsuke Kawaguchi @ 2007-11-28 17:51 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Ant completion for zsh as of 4.3.2 (and looking at CVS this is the
latest, too) reads:
> find_targets() {
> importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
> sed -n "s/ *<target[^>]* name=[\"']\([^\"']*\)[\"'].*/\1/p" $1
> if (( $#importedfiles )) ; then
> ( cd $1:h
> for file in $importedfiles ; do
> find_targets $file
> done )
> fi
> }
... but this has one annoying problem that it picks up targets names
that starts with '-', like "-foo-bar", which is by convention used for
'private' targets. These private targets can never be invoked from
command-line, as they are interpreted as options (and that's why Ant
chooses the '-' prefix for a convention.)
The following minor change to the sed invocation fixes this problem.
> find_targets() {
> importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
> sed -n "s/ *<target[^>]* name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1
> if (( $#importedfiles )) ; then
> ( cd $1:h
> for file in $importedfiles ; do
> find_targets $file
> done )
> fi
> }
I'd be grateful if this change can be incorporated into CVS.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi@sun.com
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3269 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-28 21:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-28 17:51 Patch for _ant Kohsuke Kawaguchi
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).