From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk
Subject: Re: Redirection completion
Date: Wed, 13 Mar 2002 17:58:45 +0000 [thread overview]
Message-ID: <20020313175845.GA27238@logica.com> (raw)
In-Reply-To: <15503.6928.151944.873784@wischnow.berkom.de>
Sven wrote:
> 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-').
Hmm, we might want to define -redirect-,<,-default- and would want
patterns tried before that. I think the post-patterns should perhaps be
tried just before -default- is first tried in the command position for
redirection and in the parameter name position for values. Or perhaps,
we need to look to see where each post-pattern uses -default-. If it
uses a pattern for one part then we should use it before trying
-default- for that part. We might need to require patterns to all be
of the form -whatever-,pattern,pattern.
> Can't say anything about this without more information. Have you
> remembered to remove the dump-file?
I had. I'm not sure what was wrong but it all works now with the latest
patch. I may have had an old version of a function in my ~/.zfunc.
> Aha. Ugh. No. See above, `-redirect-,-default-,gzip' etc. are enough.
> Not that short either, I admit, but allowing braces there isn't *that*
> simple (well, it isn't that hard either, a bit of `eval' with an array
> and some quoting magic, but...).
Ah, that is better, and neater than braces. I hadn't picked up on that
part of the idea. Very neat.
The patch below does the GZIP thing I mentioned. I've also added
pattern completions for *PATH and *path parameters using _dir_list and
_directories respectively. I've not thought of any exceptions where
this isn't appropriate but I'll leave sufficient time for objections
before committing.
Oliver
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 17:17:05 -0000
@@ -1,9 +1,16 @@
-#compdef gzip gunzip gzcat=gunzip
+#compdef gzip gunzip gzcat=gunzip -value-,GZIP,-default-
-local decompress expl curcontext="$curcontext" state line
+local decompress files expl curcontext="$curcontext" state line
typeset -A opt_args
+files=( '*:files:->files' )
case "$service" in
+*GZIP*)
+ compset -q
+ words=( fake "$words[@]" )
+ (( CURRENT++ ))
+ files=()
+ ;&
gunzip|zcat)
decompress=yes
;&
@@ -51,7 +58,7 @@
'(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \
'(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \
'(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \
- '*:files:->files' && return 0
+ "$files[@]" && return 0
;;
esac
Index: Completion/Unix/Type/_dir_list
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_dir_list,v
retrieving revision 1.2
diff -u -r1.2 _dir_list
--- Completion/Unix/Type/_dir_list 13 Jun 2001 11:05:51 -0000 1.2
+++ Completion/Unix/Type/_dir_list 13 Mar 2002 17:17:05 -0000
@@ -1,4 +1,4 @@
-#autoload
+#compdef -value-,TERMINFO_DIRS,-default- -P -value-,*PATH,-default-
# options:
# -s <sep> to specify the separator (default is a colon)
Index: Completion/Unix/Type/_directories
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_directories,v
retrieving revision 1.4
diff -u -r1.4 _directories
--- Completion/Unix/Type/_directories 20 Feb 2002 12:51:53 -0000 1.4
+++ Completion/Unix/Type/_directories 13 Mar 2002 17:17:05 -0000
@@ -1,4 +1,4 @@
-#compdef rmdir df du dircmp
+#compdef rmdir df du dircmp -P -value-,*path,-default-
local expl
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
next prev parent reply other threads:[~2002-03-13 18:00 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
2002-03-14 12:03 ` Sven Wischnowsky
2002-03-13 17:58 ` Oliver Kiddle [this message]
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=20020313175845.GA27238@logica.com \
--to=okiddle@yahoo.co.uk \
--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).