Re: [PATCH] bash: support user-supplied completion scripts for user's git commands

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

 



Hi Shawn,

On Fri, Jan 29, 2010 at 11:13:26AM -0800, Shawn O. Pearce wrote:
> SZEDER G?bor <szeder@xxxxxxxxxx> wrote:
> > How about something like this for subcommands (not aliases)?  It's a
> > good code size reduction anyway.
> 
> Hmm, I like this.  I just didn't know how to implement it...  :-)
> 
> Acked-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
> 
> > +	local completion_func="_git_${command//-/_}"
> > +	declare -F $completion_func >/dev/null && $completion_func
> 
> Yay for knowing bash.  :-)

Heh.  I've found out about this 'declare -F' thing about two hours ago
(;


However.

I thought this should actually "Just Work" for aliases, too.  e.g.
Junio could use the following completion function to get 'git log's
options for his lgm alias:

_git_lgm () {
        _git_log
}

Unfortunately, it doesn't work at all.

In _git() first we have 'lgm' in $command, which is ok, but then comes
this alias handling thing

        local expansion=$(__git_aliased_command "$command")
        [ "$expansion" ] && command="$expansion"

which writes '!sh' into $command, and that doesn't look quite right
for me, although I admit that I can't seem to figure out how this
__git_aliased_command() is supposed to work (so much about knowing
bash ;).  Any insight?


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]