From: Felipe Contreras <felipe.contreras@gmail.com>
To: Git <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH 2/2] completion: add proper public __git_complete
Date: Mon, 28 Dec 2020 13:26:25 -0600 [thread overview]
Message-ID: <CAMP44s1e1P0KEG4O0wrgwK7GatxiufRM1d9b2kFms4-G_3zXOg@mail.gmail.com> (raw)
In-Reply-To: <20201228192302.80467-3-felipe.contreras@gmail.com>
On Mon, Dec 28, 2020 at 1:23 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> Back in 2012 I argued [1] for the introduction of a helper that would
> allow users to specify aliases like:
>
> git_complete gf git_fetch
>
> Back then there was pushback because there was no clear guideline for
> public functions (git_complete vs _git_complete vs _GIT_complete), and
> some aliases didn't actually work.
>
> Fast-forward to 2020 and there's still no guideline for public
> functions, and those aliases still don't work (even though I sent the
> fixes).
>
> This has not prevented people from using this function that is clearly
> needed to setup custom aliases [2], and in fact it's the recommended
> way. But it is cumbersome that the user must type:
>
> __git_complete gf _git_fetch
>
> Or worse:
>
> __git_complete gk __gitk_main
>
> 8 years is more than enough time to stop waiting for the perfect to
> come; let's define a public function (with the same name) that is
> actually user-friendly:
>
> __git_complete gf git_fetch
> __git_complete gk gitk
>
> While also maintaining backwards compatibility.
>
> The logic is:
>
> 1. If $2 exists, use it directly
> 2. If not, check if __$2_main exists
> 3. If not, check if _$2 exists
> 4. If not, fail
>
> [1] https://lore.kernel.org/git/1334524814-13581-1-git-send-email-felipe.contreras@gmail.com/
> [2] https://stackoverflow.com/questions/342969/how-do-i-get-bash-completion-to-work-with-aliases
Fixed wrong address of SZEDER Gábor.
--
Felipe Contreras
prev parent reply other threads:[~2020-12-28 19:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-28 19:23 [PATCH 0/2] completion: make __git_complete public Felipe Contreras
2020-12-28 19:23 ` [PATCH 1/2] test: completion: add tests for __git_complete Felipe Contreras
2020-12-28 22:57 ` Denton Liu
2020-12-29 0:12 ` Felipe Contreras
2020-12-29 0:36 ` Felipe Contreras
2020-12-28 19:23 ` [PATCH 2/2] completion: add proper public __git_complete Felipe Contreras
2020-12-28 19:26 ` Felipe Contreras [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP44s1e1P0KEG4O0wrgwK7GatxiufRM1d9b2kFms4-G_3zXOg@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=szeder.dev@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).