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@xxxxxxx
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature