From 043c302261dfee52e54e9a6c42b4ebcc2f7ccd33 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 24 Aug 2002 19:19:14 +0000 Subject: 17577: pass classpath as an option to _java_class --- Completion/Unix/Type/_java_class | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'Completion/Unix/Type/_java_class') diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class index a89ceb3c0..76aeaaa2e 100644 --- a/Completion/Unix/Type/_java_class +++ b/Completion/Unix/Type/_java_class @@ -1,16 +1,24 @@ #autoload -local classpath -#Should probably add some sort of cache. -#First use -classpath/-cp, then CLASSPATH, then assume . -classpath=${opt_args[-classpath]:-${opt_args[-cp]:-${CLASSPATH:-.}}} -local c i -#Should we call _multipart insteads of compadd -for i in ${(z)classpath//:/ }; do - if [ -f $i ] && [[ "$i" == *.(jar|zip|war|ear) ]]; then - c=(${${${(M)$(_call_program jar_classes jar -tf $i)##*.class}%%.class}:gs#/#.#}) - compadd -M 'r:|.=* r:|=*' -- $c - elif [ -d $i ]; then - c=(**/*.class(.:r:s/.class//:gs#/#.#)) - compadd -M 'r:|.=* r:|=*' -- $c - fi + +# 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 + -- cgit 1.4.1