From: "SZEDER Gábor" <szeder@ira.uka.de>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Junio C Hamano <gitster@pobox.com>,
David Rhodes Clymer <david@zettazebra.com>,
git@vger.kernel.org
Subject: Re: [PATCH] bash: support user-supplied completion scripts for user's git commands
Date: Fri, 29 Jan 2010 21:00:33 +0100 [thread overview]
Message-ID: <20100129200033.GA32636@neumann> (raw)
In-Reply-To: <20100129191326.GD22101@spearce.org>
Hi Shawn,
On Fri, Jan 29, 2010 at 11:13:26AM -0800, Shawn O. Pearce wrote:
> SZEDER G?bor <szeder@ira.uka.de> 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@spearce.org>
>
> > + 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
next prev parent reply other threads:[~2010-01-29 20:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 12:57 Custom git completion David Rhodes Clymer
2010-01-29 15:11 ` Shawn O. Pearce
2010-01-29 17:42 ` Junio C Hamano
2010-01-29 17:59 ` Shawn O. Pearce
2010-01-29 18:02 ` Junio C Hamano
2010-01-29 19:06 ` [PATCH] bash: support user-supplied completion scripts for user's git commands SZEDER Gábor
2010-01-29 19:13 ` Shawn O. Pearce
2010-01-29 20:00 ` SZEDER Gábor [this message]
2010-01-29 20:04 ` Shawn O. Pearce
2010-01-31 19:19 ` SZEDER Gábor
2010-02-23 21:02 ` [PATCH 0/4] bash: support user-supplied completion scripts for custom git commands and aliases SZEDER Gábor
2010-02-23 21:02 ` [PATCH 1/4] bash: improve aliased command recognition SZEDER Gábor
2010-02-23 22:11 ` Junio C Hamano
2010-02-24 1:04 ` SZEDER Gábor
2010-02-24 2:56 ` Junio C Hamano
2010-02-23 21:02 ` [PATCH 2/4] bash: support user-supplied completion scripts for user's git commands SZEDER Gábor
2010-02-23 21:02 ` [PATCH 3/4] bash: support user-supplied completion scripts for aliases SZEDER Gábor
2010-02-23 21:03 ` [PATCH 4/4] bash: completion for gitk aliases SZEDER Gábor
2010-01-29 20:32 ` [PATCH] bash: support user-supplied completion scripts for user's git commands Junio C Hamano
2010-02-26 15:27 ` SZEDER Gábor
2010-02-26 20:04 ` Junio C Hamano
2010-02-26 20:17 ` Shawn O. Pearce
2010-01-30 23:34 ` David Rhodes Clymer
2010-01-30 23:03 ` Custom git completion David Rhodes Clymer
2010-01-30 23:00 ` David Rhodes Clymer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100129200033.GA32636@neumann \
--to=szeder@ira.uka.de \
--cc=david@zettazebra.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).