Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _java_class



This is a patch to add a new java class completion function.  It's not quite
right since it is uses opt{cp|classpath}.    It is intended to be used with
_java.  I'll post a separate patch for that.

-FR

Index: Completion/Unix/Type/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/.distfiles,v
retrieving revision 1.7
diff -r1.7 .distfiles
11a12
> _java_class
Index: Completion/Unix/Type/_java_class
===================================================================
RCS file: Completion/Unix/Type/_java_class
diff -N Completion/Unix/Type/_java_class
0a1,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



__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/



Messages sorted by: Reverse Date, Date, Thread, Author