git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Wagland <paul@kungfoocoder.org>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 2/4] completion: update completion arguments for stash
Date: Tue, 26 Jan 2016 10:37:19 +0100	[thread overview]
Message-ID: <20160126093718.GC77046@wagland.net> (raw)
In-Reply-To: <20160126093429.GA77046@wagland.net>


Add --all and --include-untracked to the git stash save completions.
Add --quiet to the git stash drop completions.
Update git stash branch so that the first argument expands out to the
possible branch names, and the other arguments expand to the stash
names.

Signed-off-by: Paul Wagland <paul@kungfoocoder.org>
---
 contrib/completion/git-completion.bash | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 63754bc..043d5bb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2382,7 +2382,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--keep-index --no-keep-index --quiet --patch'
+	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
 	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
@@ -2404,9 +2404,20 @@ _git_stash ()
 		apply,--*|pop,--*)
 			__gitcomp "--index --quiet"
 			;;
-		show,--*|drop,--*|branch,--*)
+		drop,--*)
+			__gitcomp "--quiet"
 			;;
-		show,*|apply,*|drop,*|pop,*|branch,*)
+		show,--*|branch,--*)
+			;;
+		branch,*)
+		  if [ $cword -eq 3 ]; then
+  			__gitcomp_nl "$(__git_refs)";
+			else
+				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+						| sed -n -e 's/:.*//p')"
+			fi
+			;;
+		show,*|apply,*|drop,*|pop,*)
 			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 					| sed -n -e 's/:.*//p')"
 			;;
-- 
2.7.0

  parent reply	other threads:[~2016-01-26  9:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23  1:23 [PATCH 0/2] Update BASH completions Paul Wagland
2016-01-23  1:25 ` PATCH 1/2] Update the flags for git show-branch Paul Wagland
2016-01-25 23:17   ` Junio C Hamano
2016-01-23  1:30 ` [PATCH 2/2] Fix up the arguments for git stash Paul Wagland
2016-01-25 23:21   ` Junio C Hamano
2016-01-26  6:21     ` Paul Wagland
2016-01-26  9:34 ` [PATCH v2 0/2] Update BASH completions Paul Wagland
2016-01-26  9:36   ` [PATCH v2 1/2] completion: complete show-branch "--date-order" Paul Wagland
2016-01-26  9:37   ` Paul Wagland [this message]
2016-02-22 13:02     ` [PATCH] completion: fix mis-indentation in _git_stash() 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160126093718.GC77046@wagland.net \
    --to=paul@kungfoocoder.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).