Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _java: fix completion when $CLASSPATH contains empty entries
- X-seq: zsh-workers 28389
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: [PATCH] _java: fix completion when $CLASSPATH contains empty entries
- Date: Sat, 6 Nov 2010 10:40:09 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=eYMEG6DesmPA5w3FffHm6i5qF1vm3amZwswIllsva0E=; b=AQZ8bH/XiYIRxQT5jS0DocbX95Snt6zYE42PPg3domkTXqeh5XvS1y09nhJeihdXrm BB4D6DcLt/WNA8hjU6kV1ND737kVWsA7RFD5OPIKpsEKJxF2AKGdTql6WRZU6I6xq400 7vsPeqqoD8dafsG2gyggESrXhhzFxPUQAqCq0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=U98QJYQ0AfC2Qiw+dtG8inKp4R003XpJt4MkG143OgP2VLqwQTk9t98/AsZCkm1nIZ L+xLKnKpfsWYqLkikigSwJMQkEXKU8I1yvixGTlT6wWYq63V+sCrNRu1m8hlHrBfVkij tWIUqjwbB7GHEbz0MAut2p7EbUIzQnCZCr4Qg=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Treat them as a . instead of a / as this is what java does.
---
jure_ on #zsh noticed that zsh took very long to complete class names, turns out
he had a trailing : in his $CLASSPATH. A quick test shows that java treats these
as a ., not a /, though this does not appear to be documented anywhere.
Completion/Unix/Type/_java_class | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class
index d81669c..0201288 100644
--- a/Completion/Unix/Type/_java_class
+++ b/Completion/Unix/Type/_java_class
@@ -13,9 +13,10 @@ classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}"
: "$classpath[@]"
for i in "${(s.:.)classpath}"; do
- if [ -f $i ] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
+ [[ -z $i ]] && i=.
+ if [[ -f $i ]] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
c+=( ${${${(M)$(_call_program jar_classes jar -tf
$i)##*.class}%%.class}:gs#/#.#} )
- elif [ -d $i ]; then
+ elif [[ -d $i ]]; then
c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
fi
done
--
1.7.3
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author