Re: [PATCH 2/4] completion: introduce __gitcomp_2 ()
From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:59:32
Junio C Hamano wrote:
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.
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.