Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using the same completion function for various commands
- X-seq: zsh-users 15622
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Using the same completion function for various commands
- Date: Mon, 6 Dec 2010 16:21:44 +0000
- In-reply-to: <20101206161020.693f3f4a@xxxxxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <201012061512.21791.mrichter@xxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTimY=rEETn1uOdkDJ33kGE=YUDAvevsBvvvMU7YL@xxxxxxxxxxxxxx> <AANLkTim1Ac1-VOkRQ1NXn_qL6-EV06bagVkK7y_UThwB@xxxxxxxxxxxxxx> <AANLkTin+NCoBRzx90fo+s0z7urCCoTA6T3cXTYdt_VD2@xxxxxxxxxxxxxx> <20101206151124.389fd287@xxxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTin8Kn88NXsK4V4Toos0-ZB2hj4RvhX5QxLarq1N@xxxxxxxxxxxxxx> <20101206161020.693f3f4a@xxxxxxxxxxxxxxxxxxxxxxxxx>
On Mon, 6 Dec 2010 16:10:20 +0000
Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> On Mon, 6 Dec 2010 16:18:47 +0100
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> > Ah, er, right. But. Is there any way to combine -p and saying
> > foo=du ? When I tried compdef _du -p 'foo_*=du' nothing happened.
Yes, I know, it *still* doesn't work, and you were about complain.
Is the following change to _pick_variant right? Why we would ever
prefer $words[1] to $service, when this seems to be what $service is
for? Am I missing cases where you definitely don't want the basic
service run in order to check a variant?
Index: Completion/Base/Utility/_pick_variant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_pick_variant,v
retrieving revision 1.2
diff -p -u -r1.2 _pick_variant
--- Completion/Base/Utility/_pick_variant 28 Feb 2009 07:11:31 -0000 1.2
+++ Completion/Base/Utility/_pick_variant 6 Dec 2010 16:18:54 -0000
@@ -7,7 +7,7 @@ local -A opts
(( $+_cmd_variant )) || typeset -gA _cmd_variant
zparseopts -D -A opts c: r:
-: ${opts[-c]:=$words[1]}
+: ${opts[-c]:=${service:-$words[1]}}
while [[ $1 = *=* ]]; do
var+=( "${1%%\=*}" "${1#*=}" )
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author