blob: 76aeaaa2e422d8fa4f4669d378ce331c989f4798 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#autoload
# Should probably add some sort of cache.
# Should we call _multi_parts insteads of compadd?
local classpath i expl
local -a c
local method type
zparseopts -D -E -a classpath t:=type m:=method cp: classpath:
: "$classpath[@]"
classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}"
: "$classpath[@]"
for i in "${(s.:.)classpath}"; do
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
c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
fi
done
_wanted classes expl 'java class' compadd "$@" -M 'r:|.=* r:|=*' -a c
|