From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1388 invoked from network); 13 Mar 2002 16:56:14 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Mar 2002 16:56:14 -0000 Received: (qmail 13502 invoked by alias); 13 Mar 2002 16:56:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16821 Received: (qmail 13490 invoked from network); 13 Mar 2002 16:56:06 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: Redirection completion In-reply-to: "Sven Wischnowsky"'s message of "Wed, 13 Mar 2002 10:25:36 +0100." <15503.6928.151944.873784@wischnow.berkom.de> Date: Wed, 13 Mar 2002 16:55:33 +0000 Message-ID: <26367.1016038533@csr.com> From: Peter Stephenson Sven Wischnowsky wrote: > It uses the comma-separated sub-contexts discussed. For values it is > `-value-,,', so I've not put the parameter type in it, as > suggested by Oliver. For redirection it is `-redirect-,,'. The following redirections for compressed files seem to work quite nicely --- uncompress input from the appropriate compressed file type, and compress output into it. Was anyone planning anything more sophisticated? > For example, completion after `foo=' makes _value try: > > 1) -value-,foo, > 2) -value-,foo,-default- > 3) -value-,-default-,-default- > > in this order. It seems vaguely preferable to allow the user to omit trailing `,-default-' bits when defining commands (it's not important in style contexts since you would usually use a wildcard anyway), but it doesn't actually gain you anything apart from laxity. > I.e.: > should `-redirect-,-default-,echo' or `-redirect-,>,-default-' take > precedence? It seems more logical that the command variant should take precedence, although the order of the parts would imply otherwise. > And another question where the default-handling is important is: when > should post-patterns (-P) be tried? Currently this is done only if we > would otherwise use the function defined for the least specific > context (the one with all parts being `-default-'). This seems OK unless we do something more complicated with pattern handling, e.g. some way of matching the point at which you want the pattern tried. But I don't see any great call for that at the moment. Index: Completion/Unix/Command/_bzip2 =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_bzip2,v retrieving revision 1.1 diff -u -r1.1 _bzip2 --- Completion/Unix/Command/_bzip2 2 Apr 2001 11:46:03 -0000 1.1 +++ Completion/Unix/Command/_bzip2 13 Mar 2002 16:34:23 -0000 @@ -1,4 +1,4 @@ -#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover +#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 local decompress expl state line curcontext="$curcontext" typeset -A opt_args Index: Completion/Unix/Command/_compress =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_compress,v retrieving revision 1.1 diff -u -r1.1 _compress --- Completion/Unix/Command/_compress 2 Apr 2001 11:46:37 -0000 1.1 +++ Completion/Unix/Command/_compress 13 Mar 2002 16:34:23 -0000 @@ -1,4 +1,4 @@ -#compdef compress uncompress +#compdef compress uncompress -redirect-,<,uncompress=uncompress -redirect-,>,compress=uncompress local expl state line bits common_args1 common_args2 decompress local curcontext="$curcontext" Index: Completion/Unix/Command/_gzip =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_gzip,v retrieving revision 1.2 diff -u -r1.2 _gzip --- Completion/Unix/Command/_gzip 31 Jul 2001 13:54:04 -0000 1.2 +++ Completion/Unix/Command/_gzip 13 Mar 2002 16:34:23 -0000 @@ -1,4 +1,4 @@ -#compdef gzip gunzip gzcat=gunzip +#compdef gzip gunzip gzcat=gunzip -redirect-,<,gunzip=gunzip -redirect-,>,gzip=gunzip local decompress expl curcontext="$curcontext" state line typeset -A opt_args -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************