Re: [PATCH v3] completion: add new _GIT_complete helper
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- May 6, 2012, 10:30 UTC
- Message-ID
- <20120506103006.GI2164@goldbirke>
- In-Reply-To
- <20120505155423.GA14684@burratino>
On Sat, May 05, 2012 at 10:54:23AM -0500, Jonathan Nieder wrote:
Show 12 quoted lines
> 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.
Show 22 quoted lines
> 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