git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH] bash completion: add basic support for git-reflog
Date: Sun, 21 Nov 2010 01:32:48 +0800	[thread overview]
Message-ID: <1290274368-3212-1-git-send-email-rctay89@gmail.com> (raw)

Add basic completion for the three subcommands - show, expire, delete.
Try completing refs for these too.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 contrib/completion/git-completion.bash |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f710469..4007ca1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1632,6 +1632,22 @@ _git_rebase ()
 	__gitcomp "$(__git_refs)"
 }
 
+_git_reflog ()
+{
+	local SUB_CMDS=(show delete expire)
+	local cur="${COMP_WORDS[COMP_CWORD-1]}"
+
+	for val in ${SUB_CMDS[*]}; do
+		if [[ "$val" == "$cur" ]]; then
+			# this is a subcommand
+			__gitcomp "$(__git_refs)"
+			return
+		fi
+	done
+
+	__gitcomp "${SUB_CMDS[*]}"
+}
+
 __git_send_email_confirm_options="always never auto cc compose"
 __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
 
-- 
1.7.3.2.496.g9c54

             reply	other threads:[~2010-11-20 17:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-20 17:32 Tay Ray Chuan [this message]
2010-11-22 15:24 ` [PATCH] bash completion: add basic support for git-reflog SZEDER Gábor
2010-11-22 15:50   ` Tay Ray Chuan
2010-11-22 17:09     ` Tay Ray Chuan
2010-11-22 17:20       ` Jonathan Nieder

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=1290274368-3212-1-git-send-email-rctay89@gmail.com \
    --to=rctay89@gmail.com \
    --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.
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).