zsh-workers
 help / color / mirror / code / Atom feed
* Count of last matches (was: RE: Reading completion manual)
@ 1999-03-03  9:05 Andrej Borsenkow
  1999-03-03 16:02 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-03  9:05 UTC (permalink / raw)
  To: ZSH workers mailing list


>
>
> Applied to all three: what about some return code to indicate, if
> some matches were added? Currently one has to save, and then
> compare, compstate[nmatches], that looks somewhat ugly. Using
> return code would provide for
>
> compgen -k friends || compgen -u
>
> Looks better for me. Probably, this idea could be used for all
> helper functions as well - is it useful?
>


What about following: add new item to compstate, say, last_nmatches, that
hold count of matches added by the *last* used compgen, compadd, compcall.
That can be used to test if we got something, and probably may be useful for
other tasks as well. And definitely better

if [[ $compstate[last_nmatches] -gt 0 ]]

than current

save nmatches
call completion
compare

cheers

/andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: Count of last matches (was: RE: Reading completion manual)
@ 1999-03-03  9:31 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-03  9:31 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> What about following: add new item to compstate, say, last_nmatches, that
> hold count of matches added by the *last* used compgen, compadd, compcall.
> That can be used to test if we got something, and probably may be useful for
> other tasks as well. And definitely better
> 
> if [[ $compstate[last_nmatches] -gt 0 ]]

Easy to add. Some more feedback?

> than current
> 
> save nmatches
> call completion
> compare

You don't like shell code, do you? ;-)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-03-03 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-03  9:05 Count of last matches (was: RE: Reading completion manual) Andrej Borsenkow
1999-03-03 16:02 ` Bart Schaefer
1999-03-03  9:31 Sven Wischnowsky

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).