git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jay Soffian" <jaysoffian@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: "Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
	"Nguyen Thai Ngoc Duy" <pclouds@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 3/3] help: respect aliases
Date: Tue, 26 Feb 2008 09:56:13 -0500	[thread overview]
Message-ID: <76718490802260656s459e9241ie2a2d6b255c77fa4@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.1.00.0802261222570.17164@racer.site>

On Tue, Feb 26, 2008 at 7:43 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
>  On Sun, 24 Feb 2008, Jay Soffian wrote:
>
>  > This too would be less ugly as a built-in:
>  >
>  >  [elided so as not to burn anyone's eyes out again :-) -- jay]
>
>  Wow.  This would look less ugly as an alias like this, too:
>
>  alias = "!sh -c 'case $# in \
>         0) git config --get-regexp \"^alias\\.\" | sed \"s/^alias\\.//\";; \
>         *) git config \"alias.$0\" ;; \
>         esac'"
>
>  which incidentally fixes a bug in your alias: you ignore $0 which is the
>  first parameter when using the sh -c '' idiom.

Test mine. Test yours. See which works. :-)

At least on my system, I had to use:

  sh -c '...' -

And then refer to $1.

>  Of course, you can change the sed call to your liking...

Most of the ugliness in mine is that I crammed the whitespace down and
that I'm using a quite involved pipeline to reformat all my aliases so
they fit into my terminal window.

But the --get-regexp is a good tip.

j.

  reply	other threads:[~2008-02-26 14:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1203890846.git.peff@peff.net>
2008-02-24 22:16 ` [PATCH 1/3] help: use parseopt Jeff King
2008-02-25  6:50   ` Christian Couder
2008-02-25  6:57     ` Jeff King
2008-02-25  7:16       ` Junio C Hamano
2008-02-24 22:17 ` [PATCH 2/3] make alias lookup a public, procedural function Jeff King
2008-02-24 22:17 ` [PATCH 3/3] help: respect aliases Jeff King
2008-02-25  2:10   ` Jay Soffian
2008-02-26 12:43     ` Johannes Schindelin
2008-02-26 14:56       ` Jay Soffian [this message]
2008-02-26 15:15         ` Johannes Schindelin
2008-02-26 20:14       ` Junio C Hamano
2008-02-26 20:31         ` Jay Soffian

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=76718490802260656s459e9241ie2a2d6b255c77fa4@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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).