From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
David Rhodes Clymer <david@zettazebra.com>,
Teemu Matilainen <teemu.matilainen@iki.fi>,
git@vger.kernel.org
Subject: Re: [PATCH 1/4] bash: improve aliased command recognition
Date: Tue, 23 Feb 2010 14:11:20 -0800 [thread overview]
Message-ID: <7v3a0rd2lz.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <90724961a941edd1317514dea0a1c64112dab61d.1266958460.git.szeder@ira.uka.de> ("SZEDER Gábor"'s message of "Tue\, 23 Feb 2010 22\:02\:57 +0100")
SZEDER Gábor <szeder@ira.uka.de> writes:
> [alias]
> lgm = "!sh -c 'GIT_NOTES_REF=refs/notes/amlog git log \"$@\" || :' -"
>
> The full parsing of a shell command alias like that in the completion
> code is clearly unfeasible. However, we can easily improve on aliased
> command recognition by eleminating stuff that is definitely not a git
> command: shell commands (anything starting with '!'), command line
> options (anything starting with '-'), environment variables (anything
> with a '=' in it), and git itself. This way the above alias would be
> handled correctly, and the completion script would correctly recognize
> "log" as the aliased git command.
I personally do not think such a heuristic is worth the trouble (both for
writing and maintaining the completion code nor runtime overhead to
iterate over words on the expansion).
I vaguely recall somebody floated an idea to tell completion code that
"you may not know what lgm is, but it takes the same set of options as
log" (either via config or a shell function---I don't recall the details).
I think that would be a lot more robust, efficient and easy to explain
solution to the same problem.
next prev parent reply other threads:[~2010-02-23 22:11 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 [this message]
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=7v3a0rd2lz.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=david@zettazebra.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
--cc=szeder@ira.uka.de \
--cc=teemu.matilainen@iki.fi \
/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).