threads / patch / 38352

patchbash completion: allow git stash store options completion

Subject: [PATCH] bash completion: allow git stash store options completion

## tl;dr

4 messages between Jan 13, 2015 and Jan 14, 2015. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Alexander Kuleshov· Jan 13, 2015, 17:53 UTC · lore

This patch adds bash completion for git stash 'store' subcommand which apperead at bd514cad (stash: introduce 'git stash store', 18 Jun 2013)

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 contrib/completion/git-completion.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Show changes to contrib/completion/git-completion.bash +4 −1
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c21190d..7578266 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2375,7 +2375,7 @@ _git_show_branch ()
 _git_stash ()
 {
 	local save_opts='--keep-index --no-keep-index --quiet --patch'
-	local subcommands='save list show apply clear drop pop create branch'
+	local subcommands='save list show apply clear drop pop create branch store'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
 		case "$cur" in
@@ -2402,6 +2402,9 @@ _git_stash ()
 			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 					| sed -n -e 's/:.*//p')"
 			;;
+		store,--*)
+			__gitcomp "--message --quiet"
+			;;
 		*)
 			;;
 		esac
-- 
2.3.0.rc0.239.g0ae1f56.dirty
Junio C Hamano· Jan 13, 2015, 18:40 UTC · re: Alexander Kuleshov · lore

Re: [PATCH] bash completion: allow git stash store options completion

Alexander Kuleshov <kuleshovmail@gmail.com> writes:
Show 5 quoted lines
> This patch adds bash completion for git stash 'store' subcommand
> which apperead at bd514cad (stash: introduce 'git stash store', 18 Jun 2013)
>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---

Hmph. The "create" and "store" subcommands are not end-user facing; they are meant to be used in scripts. I am not sure if we want to complete them in the first place. I know "create" already is in the list of completion candidates, but I wonder if adding "store" is making things worse.

I dunno.
Show 26 quoted lines
>  contrib/completion/git-completion.bash | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index c21190d..7578266 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2375,7 +2375,7 @@ _git_show_branch ()
>  _git_stash ()
>  {
>  	local save_opts='--keep-index --no-keep-index --quiet --patch'
> -	local subcommands='save list show apply clear drop pop create branch'
> +	local subcommands='save list show apply clear drop pop create branch store'
>  	local subcommand="$(__git_find_on_cmdline "$subcommands")"
>  	if [ -z "$subcommand" ]; then
>  		case "$cur" in
> @@ -2402,6 +2402,9 @@ _git_stash ()
>  			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
>  					| sed -n -e 's/:.*//p')"
>  			;;
> +		store,--*)
> +			__gitcomp "--message --quiet"
> +			;;
>  		*)
>  			;;
>  		esac
brian m. carlson· Jan 14, 2015, 19:03 UTC · re: Junio C Hamano · lore

Re: [PATCH] bash completion: allow git stash store options completion

On Tue, Jan 13, 2015 at 10:40:40AM -0800, Junio C Hamano wrote:
Show 13 quoted lines
>Alexander Kuleshov <kuleshovmail@gmail.com> writes:
>
>> This patch adds bash completion for git stash 'store' subcommand
>> which apperead at bd514cad (stash: introduce 'git stash store', 18 Jun 2013)
>>
>> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
>> ---
>
>Hmph.  The "create" and "store" subcommands are not end-user facing;
>they are meant to be used in scripts.  I am not sure if we want to
>complete them in the first place.  I know "create" already is in the
>list of completion candidates, but I wonder if adding "store" is
>making things worse.

For what it's worth, I'll often sketch out a script at the command line before putting it in a file (either because I realize I'll need to do the same thing again or I want to share it with others), so I think this might be a useful addition.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Junio C Hamano· Jan 14, 2015, 20:06 UTC · re: brian m. carlson · lore

Re: [PATCH] bash completion: allow git stash store options completion

"brian m. carlson" <sandals@crustytoothpaste.net> writes:
[administrivia: please refrain from using Mail-follow-up-to]
> For what it's worth, I'll often sketch out a script at the command
> line before putting it in a file (either because I realize I'll need
> to do the same thing again or I want to share it with others), so I
> think this might be a useful addition.

Yes, but that applies to manual pages and possibly "-h" short hint; keeping completion that is unnecessary for end-users has cost, e.g. making unique prefix longer.

← back to recent threads