* A stab at better git-show completion
@ 2007-10-19 1:44 Mikael Magnusson
2007-10-19 2:24 ` Clint Adams
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2007-10-19 1:44 UTC (permalink / raw)
To: zsh-workers
I decided i want to get very confused, so i decided to try and make
git-show completion allow
completing of the form commit:path/file where the path/file part
depends on what commit you
typed. Somehow i succeeded. (the [1,-2] is for removing the trailing colon)
http://git.mikachu.ath.cx/?p=zsh-cvs.git;a=commitdiff_plain;h=gitshow
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1010,11 +1010,25 @@ _git-show-ref () {
(( $+functions[_git-show] )) ||
_git-show () {
+ local curcontext=$curcontext state line
__git_setup_revision_arguments
_arguments -S \
$revision_arguments \
- '*:object:__git_revisions' && ret=0
+ '*:object:->object' && ret=0
+
+ case $state in
+ (object)
+ compset -P '*:'
+ if [[ -n $IPREFIX ]]; then
+ __git_tree_files $IPREFIX[1,-2]
+ else
+ _alternative \
+ 'revisions:revision:__git_revisions' \
+ 'files:file:__git_files'
+ fi
+ ;;
+ esac
}
(( $+functions[_git-show-index] )) ||
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: A stab at better git-show completion
2007-10-19 1:44 A stab at better git-show completion Mikael Magnusson
@ 2007-10-19 2:24 ` Clint Adams
0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 2007-10-19 2:24 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh-workers
On Fri, Oct 19, 2007 at 03:44:43AM +0200, Mikael Magnusson wrote:
> I decided i want to get very confused, so i decided to try and make
> git-show completion allow
> completing of the form commit:path/file where the path/file part
> depends on what commit you
> typed. Somehow i succeeded. (the [1,-2] is for removing the trailing colon)
Committing with the following modifications:
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.48
diff -u -r1.48 _git
--- Completion/Unix/Command/_git 19 Oct 2007 02:18:00 -0000 1.48
+++ Completion/Unix/Command/_git 19 Oct 2007 02:23:42 -0000
@@ -1011,6 +1011,7 @@
(( $+functions[_git-show] )) ||
_git-show () {
local curcontext=$curcontext state line
+ typeset -A opt_args
__git_setup_revision_arguments
_arguments -S \
@@ -1021,7 +1022,7 @@
(object)
compset -P '*:'
if [[ -n $IPREFIX ]]; then
- __git_tree_files $IPREFIX[1,-2]
+ __git_tree_files ${IPREFIX%:}
else
_alternative \
'revisions:revision:__git_revisions' \
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-19 2:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-19 1:44 A stab at better git-show completion Mikael Magnusson
2007-10-19 2:24 ` Clint Adams
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).