Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
A stab at better git-show completion
- X-seq: zsh-workers 23993
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: A stab at better git-show completion
- Date: Fri, 19 Oct 2007 03:44:43 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=XXZhrSHbe9gzA+3K7BflJ17+TBSaIB3GlSOTaEAR80Y=; b=KD53TKCBm8h+zBYqwDavvGGcbJxVd9cRAl/8ry2dZp8YLr7B08ni5FXPfxIF2Uus9bJpdGtXf7saGSMnql7wI/0HBDmBnieIn43qRWJ63vulRicooWCUuiZmbaFZO8BJvUxs628Fe4qoX/xoKsiAodjY4IrEqSHO10n0rLygajo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=NBDqe7YHqscj4a36oDGHhI9GF1Hfht/+uf1s+9goUJOldmCD0icGVgRoyoVOqUKmKsq9NjNg7G1cdmNyaTpvl2NpeEXEfvzns0VRztTvVNIoi2wmfiP3e2PaxMSfcRSpjeUI/+qMMhz08RC38KSSi+50GDMQ3Pm0ldWqEZN0iJA=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author