From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16735 invoked from network); 19 Aug 2002 14:48:32 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Aug 2002 14:48:32 -0000 Received: (qmail 18777 invoked by alias); 19 Aug 2002 14:48:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5266 Received: (qmail 18754 invoked from network); 19 Aug 2002 14:47:59 -0000 X-VirusChecked: Checked cc: Zsh users In-reply-to: <3D5DA795.8CE14D47@progress.com> From: Oliver Kiddle References: <3D5DA795.8CE14D47@progress.com> To: Bill Burton Subject: Re: [SUBMIT] _ant completion function MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17842.1029768370.1@logica.com> Date: Mon, 19 Aug 2002 15:47:31 +0100 Sender: kiddleo@logica.com Message-Id: On 16 Aug, Bill Burton wrote: > Here's my version of an _ant function for Ant completion support in > versions 1.3 to 1.5. Great, thanks. As I suggested in the previous mail, I've gone through this and merged it with the _ant I posted last week. The _arguments sections were almost the same and I've used the call-command style to select between your ant -projecthelp parsing and my sed solution. > zsh I'd appreciate it. There's also a minor cosmetic issue in that the > default target is printed with a leading space. The problem is I couldn't > figure out how to do a substitution while condtitionally removing a > trailing space. Using ? or * didn't work for me to make a space optional. Just using ${default_target# } does the job. The other cosmetic issue was that targets without a description were added with an empty description instead of with no description. I've attempted to fix this, hopefully without breaking the rest of it. How do you specify target descriptions in a build.xml file? > Suggested improvements > * A number of the options support completing on a classname. However, > this doesn't work unless the class file is in a package under the current > directory. It would be desirable to complete on any class in the > classpath. Since Ant's classpath isn't exposed, the best guess would be > to use a classpath of $ANT_HOME/lib/*.jar. On the 4.1 branch, there is a _java_class function which is meant to do this but I can't entirely make sense of what it is doing and how to get it to use $ANT_HOME/lib/*.jar as you suggest. It ought to use _multi_parts too. Certainly, this can still be improved. For zsh 4.0, the _java_class stuff will need the be replaced with the state from Bill's function, the -e option passed to _message needs to go and the $ANT_ARGS stuff needs to go. So don't expect this to work properly on 4.0. Oliver Index: _ant =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v retrieving revision 1.1 diff -u -r1.1 _ant --- _ant 9 Aug 2002 15:28:24 -0000 1.1 +++ _ant 19 Aug 2002 14:44:00 -0000 @@ -1,8 +1,9 @@ #compdef ant -value-,ANT_ARGS,-default- typeset -A opt_args -local state line curcontext="$curcontext" +local buildfile tmp state line curcontext="$curcontext" local target='*:target:->target' +#local CLASSPATH="$ANT_HOME/lib/*.jar" if [[ $service = *ANT_ARGS* ]]; then compset -q @@ -22,17 +23,73 @@ '-emacs[produce logging information without adornments]' \ '(-l -logfile)'{-l,-logfile}'[use specified file for log]:logfile:_files' \ '-logger[the class which is to perform logging]:classname:_java_class' \ - '-listener[add an instance of class as a project listener]:classname:_java_class' \ - '(-f -file -buildfile)'{-f,-file,-buildfile}'[use specified build file]:build file:_files' \ - '*-D[specify property with value to use]:property' \ + '*-listener[add an instance of class as a project listener]:classname:_java_class' \ + '(-f -file -buildfile -find)'{-f,-file,-buildfile}'[use specified build file]:build file:_files' \ + '*-D[specify property with value to use]:property:->property' \ '-propertyfile[load properties from specfied file]:property file:_files' \ '-inputhandler[specify class which will handle input requests]:class:_java_class' \ - '-find[search for buildfile]:file:_files' \ + '(-f -file -buildfile)-find[search for build file towards the root of filesystem]:build file:(build.xml)' \ $target && return -if [[ -n $state ]]; then - targets=( $(sed -n 's/ *