Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _postfix (postconf): Complete only applicable parameters for -X and -#.
- X-seq: zsh-workers 39338
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _postfix (postconf): Complete only applicable parameters for -X and -#.
- Date: Thu, 15 Sep 2016 04:48:55 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	daniel.shahaf.name; h=content-transfer-encoding:content-type	:date:from:in-reply-to:message-id:mime-version:references	:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=8QCMGK9OGhSr2bkN	d2Y23gcA3/Y=; b=3GCcdniXKKmuoPKoZ/IikJHobaV9QtctAgFbyK3itnUJJnsL	hOSnkUttNHbW4u1WKQ+/ncjxXc2o4qBbHmZbaN+yJ8Spn6tteDOjFf7jj47jt8Cm	tM6IZ1+hTlqVe4i3MVvgW00zTjgjFzGMVPyxT4Qq8YVBbxVqJzq6S4rsUAY=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	messagingengine.com; h=content-transfer-encoding:content-type	:date:from:in-reply-to:message-id:mime-version:references	:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=8QCMGK9OGhSr2bk	Nd2Y23gcA3/Y=; b=draNX0CNn4HL2+otGVgPRTLTnon9Dtv8emzYdRjfxU1hfuV	MCrQdpIKPkWO4tQRs9psA1NjAYgHVA+8vyrqw3+/6Lk5aBrEENlP1YytzmX3Qrla	Xy/aPyXs4X6bj0htIa7f1cCNVs+d8qtdLFjCcR4+FnodDBe+T1f0iyzYGzSQ=
- In-reply-to: <160914203506.ZM32505@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1473830073-331-1-git-send-email-danielsh@fujitsu.shahaf.local2> <160914094658.ZM29734@torch.brasslantern.com> <20160915021503.GA15486@fujitsu.shahaf.local2> <160914203506.ZM32505@torch.brasslantern.com>
Bart Schaefer wrote on Wed, Sep 14, 2016 at 20:35:06 -0700:
> On Sep 15,  2:15am, Daniel Shahaf wrote:
> } Subject: Re: [PATCH] _postfix (postconf): Complete only applicable paramet
> }
> } The prompt says:
> } 
> }     zsh: do you wish to see all 112 possibilities (28 lines)?
> } 
> } If I answer "yes" then I get 28 lines, that show everything in my
> } `postconf -n` output and nothing else:
> 
> And how many words is that, all together?  I think it must be counting
> the words in the descriptions as "possibilities" which probably has
> something to do with the way the column positions are abused to get
> the description to line up nicely alongside the thing described.
Bingo.  I see it now.  My 'postconf -n' has:
- 1 value that repeats 3 times
- 2 values that repeat twice, each
- 25 values that appear once each
So _describe puts that into a table as follows:
a1  a2  a3  -- va
b1  b2      -- vb
c1  c2      -- vc
k1          -- v1
k2          -- v2
⋮
k25         -- v25
The table has 4 columns — headed by "a1", "a2", "a3", and "-- v1" where
the double-hyphen is the list-separator style — and 28 rows, so it
counts as 28×4 = 112 matches.
Here's a reproducer:
_f () {
	a=( )
	i=25
	while (( i-- )
	do
		a+=( k${i}:v$i )
	done
	a+=( a{1..3}:va b{1..2}:vb c{1..2}:vc )
	a=( ${a/:/_______________________:} )
	_describe d a
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author