git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH] bash: support pretty format aliases
Date: Sun, 10 Oct 2010 23:34:21 +0200	[thread overview]
Message-ID: <1286746461-7338-1-git-send-email-szeder@ira.uka.de> (raw)

Users can have their own pretty format aliases since 8028184 (pretty:
add aliases for pretty formats, 2010-05-02), so let's offer those
after '--pretty=', too.

Similar to the completion of aliases, this will invoke 'git config'
each time pretty aliases needs to be completed, so changes in pretty.*
configuration will be reflected immediately.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6756990..3022213 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1368,7 +1368,16 @@ _git_log ()
 	fi
 	case "$cur" in
 	--pretty=*)
-		__gitcomp "$__git_log_pretty_formats
+		local pretty_aliases
+		for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do
+			case "$i" in
+			pretty.*)
+				i="${i#pretty.}"
+				pretty_aliases="$pretty_aliases ${i/ */}"
+				;;
+			esac
+		done
+		__gitcomp "$__git_log_pretty_formats $pretty_aliases
 			" "" "${cur##--pretty=}"
 		return
 		;;
-- 
1.7.3.1.148.g2fffa

             reply	other threads:[~2010-10-10 21:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-10 21:34 SZEDER Gábor [this message]
2010-10-10 21:44 ` [PATCH] bash: support pretty format aliases Jonathan Nieder
2010-10-10 22:06   ` [PATCH v2] " SZEDER Gábor
2010-10-14  8:55     ` SZEDER Gábor
2010-10-14  8:58       ` [PATCH 1/2] bash: add helper function to get config variables for completion SZEDER Gábor
2010-10-14 17:15         ` Jonathan Nieder
2010-10-20 22:29           ` SZEDER Gábor
2010-10-14  8:58       ` [PATCH 2/2] bash: support pretty format aliases SZEDER Gábor

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=1286746461-7338-1-git-send-email-szeder@ira.uka.de \
    --to=szeder@ira.uka.de \
    --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.
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).