Re: [PATCH v3] completion: add new _GIT_complete helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 05, 2012 at 10:54:23AM -0500, Jonathan Nieder wrote:
> Felipe Contreras wrote:
> 
> > Since v3:
> >
> >  * Rename to _GIT_complete to follow bash completion "guidelines"
> >  * Get rid of foo_wrap name
> 
> Thanks.  Gábor, does the "all caps _GIT_ prefix for public API
> functions" convention look like one we should adopt?  If I understand
> correctly, previously contrib/completion/git-completion.bash used
> leading double underscores for everything except completion functions,
> so this is a change.

Dunno.  I have only three concerns:

- It doesn't contaminate "my" namespace, where my installed programs,
  aliases, and shell functions are, i.e. it begins with an underscore.
- Its name conveys that it's git-specific.
- It's not called _git_complete, so the completion script (in
  particular at the end of _git()) won't misrecognize it as a
  completion function for the 'git complete' command, just in case
  somebody ever happens to have such a command or alias.

I'm not sure about the capital letters, but it fulfills all three.


> I personally would be happier with a git_complete function provided
> by another script, like this:
> 
> 	contrib/completion/git-completion.bash:
> 
> 		__git_complete () {
> 			...
> 		}
> 
> 	contrib/completion/bash-helpers.bash:
> 
> 		git_complete () {
> 			__git_complete "$@"
> 		}
> 
> One might object that if the user includes bash-helpers.bash (name is
> just a strawman) in .bashrc for interactive shells because he is
> defining some custom completion functions,
> 
> 	git<TAB>
> 
> would show the git_complete function.  I think that's fine.

It depends on what else will go into that bash-helpers.bash file.  If
I have to source it to use git completion or the git-specific bash
prompt, then I won't be very happy about it.

> Maybe
> the user would enjoy the reminder.

A reminder for what?

It's a configuration thing, so it will be used in .bashrc; I think
it's quite unlikely that it will be used interactively.


Best,
Gábor

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]