zsh-workers
 help / color / mirror / code / Atom feed
020128823bf8a6fff9537352f224eeafdc4f2030 blob 681 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
#autoload

# Should probably add some sort of cache.
# Should we call _multi_parts instead 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
  [[ -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
    c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
  fi
done

_wanted classes expl 'java class' compadd "$@" -M 'r:|.=* r:|=*' -a - c

debug log:

solving 0201288 ...
found 0201288 in https://git.vuxu.org/mirror/zsh/

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).