Re: [PATCH v2] completion: add new git_complete helper
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Apr 16, 2012, 20:04 UTC
- Message-ID
- <CAMP44s2_VYNFeBi9GPa9CeqT=oRmSq1J1XaSP+aKgC6bJ55Lfg@mail.gmail.com>
- In-Reply-To
- <20120416160729.GM5813@burratino>
On Mon, Apr 16, 2012 at 7:07 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Junio C Hamano wrote: > >> I am OK with introducing git_ps1 while keeping __git_ps1 as an equivalent >> and declare that git_$anything will be the surface interface for end users >> to *use* the machinery we provide, though. > > The problem is that completion scripts are often included implicitly > in .profile through the bash completion machinery. Users do not have > to explicitly ask for them, so there is no reason for users to expect > that the function name "more_cowbell" is dangerous to use in .profile > because some day the completion script for the "more" command will > start using it.
Sure, that's why we would have _git_cowbell instead, so for *most* of functions the user would have no trouble, it would *only* be git_completion the one without prefix, and I think the name is quite safe. There's quite likely few, probably nobody, actually using that function name in their profiles.
Also, the script would now be loaded only *after*, the user types 'git <TAB>'. And there's already a bunch of functions that are already exported by just having bash completion: have(), quote(), dequote(), quote_readline(). And there's at least one script that uses a function without a prefix: ri_get_methods()
I would like to see a completion script that actually has a function supposed to be exported and that still uses the _ prefix anyway.
Cheers.
-- Felipe Contreras