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 28388
- 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:38:29 +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=/dMQD3BTnjCQkXTLgEBbgtEyQ2Jf8Nct22xhyfVy5O0=; b=WuvRrd+kODDNkTvJeRZ1e3u6GjDxlz+YXZ2asxTeB6HtCAggbPugLgHhC/lENJXLgD P0mm3aQltbcM3L16o+zt1Kvj/cNfmxGpBCKWA6LgSYi+P9A/rNV2TqnGMpo8zknsW8rI s02kPWan+uSZlDQTKaubLkTvnf8F+EPTgoBxU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=TsDkRBcpBPsCLlyrchSJtHYp/ZhzAusH7TLpPm5h9aIDS3tq5P4DdRkQ2R58o1Vbbf mUBLz9eZL4AmkR+WWAbBQtLXE3ezRIOSfYp9+knavvUv3is0veql5BEi1LEeUTiuV4pO X90JT/VyDTte6Q7wEHGcTif0hhrUBk3KdKaqQ=
- 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
--
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author