git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash: support pretty format aliases
@ 2010-10-10 21:34 SZEDER Gábor
  2010-10-10 21:44 ` Jonathan Nieder
  0 siblings, 1 reply; 8+ messages in thread
From: SZEDER Gábor @ 2010-10-10 21:34 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Junio C Hamano, git, SZEDER Gábor

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-10-20 22:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 21:34 [PATCH] bash: support pretty format aliases SZEDER Gábor
2010-10-10 21:44 ` 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

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).