Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Count of last matches (was: RE: Reading completion manual)



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



Messages sorted by: Reverse Date, Date, Thread, Author