From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Contributed bash completion support for core Git tools.
Date: Mon, 18 Sep 2006 13:42:25 -0400 [thread overview]
Message-ID: <20060918174225.GC31140@spearce.org> (raw)
In-Reply-To: <7virjlr3am.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Shawn Pearce <spearce@spearce.org> writes:
>
> > +_git_log ()
> > +{
> > +...
> > +}
> > +...
> > +_git_whatchanged ()
> > +{
> > +...
> > +}
>
> These two look the same. Probably not very easy to maintain in
> the long run.
They are the same.
> It would be nice to have git-show as well but it usually does
> not take ranges unlike these two. It is more like "git branch"
> from completion purposes.
Like this? :-)
-- >8 --
Consolidated git_log and git_whatchanged; added git_show.
Minor requests from Junio: Consolidate the identical implementations of
git_log and git_whatchanged, especially since these two commands take
pretty much identical arguments. This should make the completion package
a little easier to maintain.
Also added branch name completion for git-show. I tried to implement
--pretty=oneline (etc.) but am apparently missing something as bash did
not want to complete it through the registered completion routine, so that's
still unsupported.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
contrib/bash-git-completion.sh | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/contrib/bash-git-completion.sh b/contrib/bash-git-completion.sh
index 4800185..e8cf6bb 100644
--- a/contrib/bash-git-completion.sh
+++ b/contrib/bash-git-completion.sh
@@ -254,19 +254,10 @@ _git_push ()
esac
}
-_git_whatchanged ()
+_git_show ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- *..*)
- local pfx=$(echo "$cur" | sed 's/\.\..*$/../')
- cur=$(echo "$cur" | sed 's/^.*\.\.//')
- COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs .)" -- "$cur"))
- ;;
- *)
- COMPREPLY=($(compgen -W "$(__git_refs .)" -- "$cur"))
- ;;
- esac
+ COMPREPLY=($(compgen -W "$(__git_refs .)" -- "$cur"))
}
_git ()
@@ -288,7 +279,8 @@ _git ()
ls-tree) _git_ls_tree ;;
pull) _git_pull ;;
push) _git_push ;;
- whatchanged) _git_whatchanged ;;
+ show) _git_show ;;
+ whatchanged) _git_log ;;
*) COMPREPLY=() ;;
esac
fi
@@ -314,7 +306,8 @@ complete -o default -o nospace -F _git_l
complete -o default -F _git_merge_base git-merge-base
complete -o default -o nospace -F _git_pull git-pull
complete -o default -o nospace -F _git_push git-push
-complete -o default -o nospace -F _git_whatchanged git-whatchanged
+complete -o default -F _git_show git-show
+complete -o default -o nospace -F _git_log git-whatchanged
# The following are necessary only for Cygwin, and only are needed
# when the user has tab-completed the executable name and consequently
@@ -327,4 +320,4 @@ complete -o default -o nospace -F _git_l
complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
complete -o default -F _git_merge_base git-merge-base.exe
complete -o default -o nospace -F _git_push git-push.exe
-complete -o default -o nospace -F _git_whatchanged git-whatchanged.exe
+complete -o default -o nospace -F _git_log git-whatchanged.exe
--
1.4.2.1.ga817
next prev parent reply other threads:[~2006-09-18 17:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 0:48 [PATCH] Contributed bash completion support for core Git tools Shawn Pearce
2006-09-18 1:03 ` Junio C Hamano
2006-09-18 1:18 ` Shawn Pearce
2006-09-28 16:16 ` Junio C Hamano
2006-09-28 16:28 ` Shawn Pearce
2006-09-18 8:17 ` Johannes Schindelin
2006-09-18 17:29 ` Shawn Pearce
2006-09-18 8:23 ` Junio C Hamano
2006-09-18 17:42 ` Shawn Pearce [this message]
2006-09-18 8:31 ` Sebastian Harl
2006-09-18 17:55 ` Shawn Pearce
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=20060918174225.GC31140@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.