diff options
author | Felix Rosencrantz <f_rosencrantz@users.sourceforge.net> | 2002-04-10 05:24:29 +0000 |
---|---|---|
committer | Felix Rosencrantz <f_rosencrantz@users.sourceforge.net> | 2002-04-10 05:24:29 +0000 |
commit | 21139de01d669592a22fd2c3eec5f6e938fe3aa2 (patch) | |
tree | ab92849a0dc821d9736e23a1be0ad6817023360d | |
parent | c5ebd0fad00a591c61c623f9355579fa9b247b96 (diff) | |
download | zsh-21139de01d669592a22fd2c3eec5f6e938fe3aa2.tar.gz zsh-21139de01d669592a22fd2c3eec5f6e938fe3aa2.tar.xz zsh-21139de01d669592a22fd2c3eec5f6e938fe3aa2.zip |
New _java_class to find classes on the classpath.
-rw-r--r-- | Completion/Unix/Type/.distfiles | 1 | ||||
-rw-r--r-- | Completion/Unix/Type/_java_class | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles index 52d55f0ca..b57c067a6 100644 --- a/Completion/Unix/Type/.distfiles +++ b/Completion/Unix/Type/.distfiles @@ -9,4 +9,5 @@ _files _pdf _pspdf _users _groups _perl_basepods _signals _users_on _hosts _perl_builtin_funcs _tar_archive _time_zone _file_systems _net_interfaces _terminals _locales +_java_class ' diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class new file mode 100644 index 000000000..ffbcfe735 --- /dev/null +++ b/Completion/Unix/Type/_java_class @@ -0,0 +1,15 @@ +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 +done |