threads / discuss / 54593

Completion for aliases that wrap aliases that wrap Git commands

Subject: Completion for aliases that wrap aliases that wrap Git commands

## tl;dr

3 messages between Nov 6, 2020 and Nov 10, 2020.

replies: 2people: 2as markdown or json

Philippe Blain· Nov 6, 2020, 22:42 UTC · lore
Hello all,

I've noticed the following: I have a Git alias that is simply a Git command with some options, like

$ git config --get alias.logo log --abbrev-commit --decorate --format=format:'%C(yellow bold)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ad)%C(reset) %C(auto)%d%C(reset)'

And another alias that is this previous alias with more options:

$ git config --get alias.lg logo --first-parent

When typing 'git logo up[TAB][TAB]', the Bash completion script suggests 'upstream' (like if I type 'git log up[TAB][TAB]'), but typing 'git lg up[TAB][TAB]' does not suggest anything.

So I'm thinking there is some special logic in the completion script that makes it work for simple aliases but not for recursive aliases.

I know nothing about Bash completions, but I'm wondering if that feature would be possible at all ?

This is on Bash 4.4.19(1) (not that I think it matters very much...)
Cheers,
Philippe.
Felipe Contreras· Nov 9, 2020, 21:56 UTC · re: Philippe Blain · lore

Re: Completion for aliases that wrap aliases that wrap Git commands

Hello,

On Fri, Nov 6, 2020 at 4:46 PM Philippe Blain <levraiphilippeblain@gmail.com> wrote:

> I know nothing about Bash completions, but I'm wondering if that feature would
> be possible at all ?
Yeap. I just sent a patch for that:
https://lore.kernel.org/git/20201109215248.461167-1-felipe.contreras@gmail.com/
Cheers.
-- 
Felipe Contreras
Philippe Blain· Nov 10, 2020, 03:01 UTC · re: Felipe Contreras · lore

Re: Completion for aliases that wrap aliases that wrap Git commands

Hi Felipe,
Show 13 quoted lines
> Le 9 nov. 2020 à 16:56, Felipe Contreras <felipe.contreras@gmail.com> a écrit :
> 
> Hello,
> 
> On Fri, Nov 6, 2020 at 4:46 PM Philippe Blain
> <levraiphilippeblain@gmail.com> wrote:
> 
>> I know nothing about Bash completions, but I'm wondering if that feature would
>> be possible at all ?
> 
> Yeap. I just sent a patch for that:
> 
> https://lore.kernel.org/git/20201109215248.461167-1-felipe.contreras@gmail.com/
Great! thanks.
Philippe.

← back to recent threads