From: David Rhodes Clymer <david@zettazebra.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: Junio C Hamano <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
git@vger.kernel.org
Subject: Re: [PATCH] bash: support user-supplied completion scripts for user's git commands
Date: Sat, 30 Jan 2010 18:34:06 -0500 [thread overview]
Message-ID: <9b69cfcf1001301534v734f8c9ao3143854c2ca5093f@mail.gmail.com> (raw)
In-Reply-To: <20100129190642.GA31303@neumann>
2010/1/29 SZEDER Gábor <szeder@ira.uka.de>:
> The bash completion script already provides support to complete
> aliases, options and refs for aliases (if the alias can be traced back
> to a supported git command by __git_aliased_command()), and the user's
> custom git commands, but it does not support the options of the user's
> custom git commands (of course; how could it know about the options of
> a custom git command?). Users of such custom git commands could
> extend git's bash completion script by writing functions to support
> their commands, but they might have issues with it: they might not
> have the rights to modify a system-wide git completion script, and
> they will need to track and merge upstream changes in the future.
>
> This patch addresses this by providing means for users to supply
> custom completion scriplets for their custom git commands without
> modifying the main git bash completion script.
>
> Instead of having a huge hard-coded list of command-completion
> function pairs (in _git()), the completion script will figure out
> which completion function to call based on the command's name. That
> is, when completing the options of 'git foo', the main completion
> script will check whether the function '_git_foo' is declared, and if
> declared, it will invoke that function to perform the completion. If
> such a function is not declared, it will fall back to complete file
> names. So, users will only need to provide this '_git_foo' completion
> function in a separate file, source that file, and it will be used the
> next time they press TAB after 'git foo '.
>
> There are two git commands (stage and whatchanged), for which the
> completion functions of other commands were used, therefore they
> got their own completion function.
>
Excellent! This looks just like what I was after. Among other things,
this is much better than my use of awk. ;o)
-davidc
next prev parent reply other threads:[~2010-01-30 23:34 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
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 [this message]
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=9b69cfcf1001301534v734f8c9ao3143854c2ca5093f@mail.gmail.com \
--to=david@zettazebra.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
--cc=szeder@ira.uka.de \
/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).