git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash: support 'git notes' and its subcommands
@ 2010-01-28  1:05 SZEDER Gábor
  2010-01-28  1:21 ` Shawn O. Pearce
  2010-01-28  1:23 ` Johan Herland
  0 siblings, 2 replies; 5+ messages in thread
From: SZEDER Gábor @ 2010-01-28  1:05 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor

... and it will offer refs unless after -m or -F, because these two
options require a non-ref argument.

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

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9651720..8b56c34 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1306,6 +1306,24 @@ _git_name_rev ()
 	__gitcomp "--tags --all --stdin"
 }
 
+_git_notes ()
+{
+	local subcommands="edit show"
+	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
+		__gitcomp "$subcommands"
+		return
+	fi
+
+	case "${COMP_WORDS[COMP_CWORD-1]}" in
+	-m|-F)
+		COMPREPLY=()
+		;;
+	*)
+		__gitcomp "$(__git_refs)"
+		;;
+	esac
+}
+
 _git_pull ()
 {
 	__git_complete_strategy && return
@@ -2218,6 +2236,7 @@ _git ()
 	merge-base)  _git_merge_base ;;
 	mv)          _git_mv ;;
 	name-rev)    _git_name_rev ;;
+	notes)       _git_notes ;;
 	pull)        _git_pull ;;
 	push)        _git_push ;;
 	rebase)      _git_rebase ;;
-- 
1.7.0.rc0.28.g3ad3d5

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

* Re: [PATCH] bash: support 'git notes' and its subcommands
  2010-01-28  1:05 [PATCH] bash: support 'git notes' and its subcommands SZEDER Gábor
@ 2010-01-28  1:21 ` Shawn O. Pearce
  2010-01-28  1:23 ` Johan Herland
  1 sibling, 0 replies; 5+ messages in thread
From: Shawn O. Pearce @ 2010-01-28  1:21 UTC (permalink / raw)
  To: SZEDER G??bor; +Cc: git, Junio C Hamano

SZEDER G??bor <szeder@ira.uka.de> wrote:
> ... and it will offer refs unless after -m or -F, because these two
> options require a non-ref argument.
> 
> Signed-off-by: SZEDER G??bor <szeder@ira.uka.de>
> ---
>  contrib/completion/git-completion.bash |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)

Acked-by: Shawn O. Pearce <spearce@spearce.org>
 
-- 
Shawn.

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

* Re: [PATCH] bash: support 'git notes' and its subcommands
  2010-01-28  1:05 [PATCH] bash: support 'git notes' and its subcommands SZEDER Gábor
  2010-01-28  1:21 ` Shawn O. Pearce
@ 2010-01-28  1:23 ` Johan Herland
  2010-01-28  3:30   ` SZEDER Gábor
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Herland @ 2010-01-28  1:23 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git, Shawn O. Pearce, Junio C Hamano

On Thursday 28 January 2010, SZEDER Gábor wrote:
> ... and it will offer refs unless after -m or -F, because these two
> options require a non-ref argument.

Maybe-NAK.

The patch is probably good in itself, and the intent is certainly good, but 
we're currently discussing deprecating the -m/-F options to "git notes edit" 
(see http://article.gmane.org/gmane.comp.version-control.git/138215), and if 
that's where we go, there's no point "encouraging" their use by adding bash-
completions for them...


...Johan

> 
> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
> ---
>  contrib/completion/git-completion.bash |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash
>  b/contrib/completion/git-completion.bash index 9651720..8b56c34 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1306,6 +1306,24 @@ _git_name_rev ()
>  	__gitcomp "--tags --all --stdin"
>  }
> 
> +_git_notes ()
> +{
> +	local subcommands="edit show"
> +	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
> +		__gitcomp "$subcommands"
> +		return
> +	fi
> +
> +	case "${COMP_WORDS[COMP_CWORD-1]}" in
> +	-m|-F)
> +		COMPREPLY=()
> +		;;
> +	*)
> +		__gitcomp "$(__git_refs)"
> +		;;
> +	esac
> +}
> +
>  _git_pull ()
>  {
>  	__git_complete_strategy && return
> @@ -2218,6 +2236,7 @@ _git ()
>  	merge-base)  _git_merge_base ;;
>  	mv)          _git_mv ;;
>  	name-rev)    _git_name_rev ;;
> +	notes)       _git_notes ;;
>  	pull)        _git_pull ;;
>  	push)        _git_push ;;
>  	rebase)      _git_rebase ;;
> 


-- 
Johan Herland, <johan@herland.net>
www.herland.net

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

* Re: [PATCH] bash: support 'git notes' and its subcommands
  2010-01-28  1:23 ` Johan Herland
@ 2010-01-28  3:30   ` SZEDER Gábor
  2010-01-28 10:02     ` Johan Herland
  0 siblings, 1 reply; 5+ messages in thread
From: SZEDER Gábor @ 2010-01-28  3:30 UTC (permalink / raw)
  To: Johan Herland; +Cc: git, Shawn O. Pearce, Junio C Hamano

Hi Johan,


On Thu, Jan 28, 2010 at 02:23:35AM +0100, Johan Herland wrote:
> On Thursday 28 January 2010, SZEDER Gábor wrote:
> > ... and it will offer refs unless after -m or -F, because these two
> > options require a non-ref argument.
> 
> Maybe-NAK.
> 
> The patch is probably good in itself, and the intent is certainly good, but 
> we're currently discussing deprecating the -m/-F options to "git notes edit" 
> (see http://article.gmane.org/gmane.comp.version-control.git/138215), and if 
> that's where we go, there's no point "encouraging" their use by adding bash-
> completions for them...

-m and -F are not encouraged, because they are not offered (short
options in general are never offered by the completion script).
However, their presence or absence is taken into account to offer
something sensible: refs after 'git notes edit <TAB>', files after
'git notes edit -F <TAB>'.  Note, that I chose 'edit' here, because
currently it's the only subcommand taking '-F', but it will actually
work the same way with the upcoming 'add' and 'append' subcommands.


Best,
Gábor


[btw, Shawn, could you have a look at
http://article.gmane.org/gmane.comp.version-control.git/137754 ?]

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

* Re: [PATCH] bash: support 'git notes' and its subcommands
  2010-01-28  3:30   ` SZEDER Gábor
@ 2010-01-28 10:02     ` Johan Herland
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Herland @ 2010-01-28 10:02 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git, Shawn O. Pearce, Junio C Hamano

On Thursday 28 January 2010, SZEDER Gábor wrote:
> Hi Johan,
> 
> On Thu, Jan 28, 2010 at 02:23:35AM +0100, Johan Herland wrote:
> > On Thursday 28 January 2010, SZEDER Gábor wrote:
> > > ... and it will offer refs unless after -m or -F, because these two
> > > options require a non-ref argument.
> >
> > Maybe-NAK.
> >
> > The patch is probably good in itself, and the intent is certainly good,
> > but we're currently discussing deprecating the -m/-F options to "git
> > notes edit" (see
> > http://article.gmane.org/gmane.comp.version-control.git/138215), and if
> > that's where we go, there's no point "encouraging" their use by adding
> > bash- completions for them...
> 
> -m and -F are not encouraged, because they are not offered (short
> options in general are never offered by the completion script).
> However, their presence or absence is taken into account to offer
> something sensible: refs after 'git notes edit <TAB>', files after
> 'git notes edit -F <TAB>'.  Note, that I chose 'edit' here, because
> currently it's the only subcommand taking '-F', but it will actually
> work the same way with the upcoming 'add' and 'append' subcommands.

Ah, ok, then. I revoke my NAK.


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

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

end of thread, other threads:[~2010-01-28 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28  1:05 [PATCH] bash: support 'git notes' and its subcommands SZEDER Gábor
2010-01-28  1:21 ` Shawn O. Pearce
2010-01-28  1:23 ` Johan Herland
2010-01-28  3:30   ` SZEDER Gábor
2010-01-28 10:02     ` Johan Herland

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