zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: Redirection completion
Date: Wed, 13 Mar 2002 16:55:33 +0000	[thread overview]
Message-ID: <26367.1016038533@csr.com> (raw)
In-Reply-To: "Sven Wischnowsky"'s message of "Wed, 13 Mar 2002 10:25:36 +0100." <15503.6928.151944.873784@wischnow.berkom.de>

Sven Wischnowsky wrote:
> It uses the comma-separated sub-contexts discussed. For values it is
> `-value-,<name>,<cmd>', so I've not put the parameter type in it, as
> suggested by Oliver. For redirection it is `-redirect-,<op>,<cmd>'.

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=<TAB>' 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 <pws@csr.com>                  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.
**********************************************************************


  reply	other threads:[~2002-03-13 16:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-08 12:33 Peter Stephenson
2002-03-08 12:54 ` Sven Wischnowsky
2002-03-08 14:06   ` Peter Stephenson
2002-03-08 14:10     ` Sven Wischnowsky
2002-03-11  8:42       ` Sven Wischnowsky
2002-03-11  9:58         ` Sven Wischnowsky
2002-03-11 10:54         ` Peter Stephenson
2002-03-11 11:16           ` Sven Wischnowsky
2002-03-11 11:29             ` Peter Stephenson
2002-03-11 12:08               ` Sven Wischnowsky
2002-03-11 14:01                 ` Peter Stephenson
2002-03-11 16:56                 ` Bart Schaefer
2002-03-12  9:03                   ` Sven Wischnowsky
2002-03-12 13:16         ` Oliver Kiddle
2002-03-13  9:25           ` Sven Wischnowsky
2002-03-13 16:55             ` Peter Stephenson [this message]
2002-03-14 12:03               ` Sven Wischnowsky
2002-03-13 17:58             ` Oliver Kiddle
2002-03-13 18:19               ` Bart Schaefer
2002-03-14 13:51                 ` Oliver Kiddle
2002-03-14 14:41                   ` Peter Stephenson
2002-03-14 14:43                     ` Sven Wischnowsky
2002-03-08 13:20 ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26367.1016038533@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).