Re: [PATCH 2/4] completion: introduce __gitcomp_2 ()
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jan 3, 2014, 19:09 UTC
- Message-ID
- <CALkWK0nQ30fg0RjgKq9WSb2Mv9W8xQsK+wy9hzHt7RGpBbad-Q@mail.gmail.com>
- In-Reply-To
- <xmqqwqihlzuj.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 5 quoted lines
> I am not sure what you are worried about $pfx; what does it do when > you have strings with different prefix in COMPREPLY? If it breaks, > then the answer is "don't do it then". > > Doesn't an array know its own length and give you a way to ask?
Right. I was just throwing counterpoints at the wall.
Show 11 quoted lines
> Imagine if one is flipping 47 topic branches from 6 contributors > whose names all begin with 'j'. I can see that such a person would > appreciate if "git config branch.j<TAB>" did not dump all 47 topics > at once but offered "jc/ jk/ jl/ jm/ jn/ js/" instead, and then a > follow-up completion of "git config branch.jk/<TAB>" expanded to > names of topics from that single contributor "jk". Wouldn't the way > to give these be either to return these two-letter hierarchy names > with slash as the suffix or to return list of two-letter plus a > slash with an empty suffix? Either way, that is using something > different from a dot or a space, so that may count as the third, I > guess.
Ah, after completing branch.jk/, we would want no suffix: so the example definitely counts as a third "completion class". I agree with your reasoning, and will rework the series to do the _append () thing you suggested.
Thanks.