Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Use that git-show completion in more places.
- X-seq: zsh-workers 23999
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Use that git-show completion in more places.
- Date: Sat, 20 Oct 2007 05:02:57 +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=FO/NyjZrdTQ0AZGwwPjcH5FIP3K5B6+1fHIoRV156Bs=; b=qri8rZVPEuI1WnW0NsQAL8tGcoyiyMe1GI//7YZ5HdN1mmlUoj1MpmVddlo1SzhTozJlMx9sNOmZftergpL9aPohiczFZ9p5P4dioXvKldrCqHGuFbOifXaz89BSKzvr320oxEmcnwe4lyECOkzW74n8ppZ0KVbmDQPaDtdkmbo=
- 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=kZAjn0sH7WwMYBymPDXLT2a/OxZr2hYgDM61HwrRPXa5oylJtEwjOnkxdkyivcKbFBQmXiPMExqvDiovPJue9XQt1PqPMLvhB/yJ8ExZtSBcG4O0koUmjqekhv/XJsZAAwGarptp3TdsStrmJkTrO+iTdYpbmn7nLmV5KzK2ctY=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This makes some completions that would just verify you typed a hex
number complete that rev:file i added for git-show earlier. Ideally
the _git_trees should only complete rev:dir, not rev:dir/file, but I
guess just don't type files for now :). I guess in some cases it
should complete directly to rev: instead of making you type the colon,
since those commands don't take commit-ishes, but I'm not sure how to
do that (or if it's worth the trouble).
http://git.mikachu.ath.cx/?p=zsh-cvs.git;a=commitdiff_plain;h=revfile
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 95acdaf..5f71848 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1016,20 +1016,7 @@ _git-show () {
_arguments -S \
$revision_arguments \
- '*:object:->object' && ret=0
-
- case $state in
- (object)
- compset -P '*:'
- if [[ -n $IPREFIX ]]; then
- __git_tree_files ${IPREFIX%:}
- else
- _alternative \
- 'revisions:revision:__git_revisions' \
- 'files:file:__git_files'
- fi
- ;;
- esac
+ '*:object:__git_objects' && ret=0
}
(( $+functions[_git-show-index] )) ||
@@ -2273,7 +2260,7 @@ _git-rev-parse () {
'--short=-[show only handful hexdigits prefix]:: :_guard
"[[\:digit\:]]#" number' \
{--after=-,--since=-}'[show "--max-age=" parameter corresponding
given date string]:datestring' \
{--berore=-,--until=-}'[show "--min-age=" parameter corresponding
given date string]:datestring' \
- '*:args' && ret=0
+ '*:objects:__git_objects' && ret=0
}
(( $+functions[_git-runstatus] )) ||
@@ -2570,12 +2557,19 @@ __git_command_successful () {
(( $+functions[__git_objects] )) ||
__git_objects () {
- __git_guard $* "[[:xdigit:]]#" "object"
+ compset -P '*:'
+ if [[ -n $IPREFIX ]]; then
+ __git_tree_files ${IPREFIX%:}
+ else
+ _alternative \
+ 'revisions:revision:__git_revisions' \
+ 'files:file:__git_files'
+ fi
}
(( $+functions[__git_trees] )) ||
__git_trees () {
- __git_guard $* "[[:xdigit:]]#" "tree"
+ __git_objects
}
(( $+functions[__git_tree_ishs] )) ||
@@ -2585,7 +2579,7 @@ __git_tree_ishs () {
(( $+functions[__git_blobs] )) ||
__git_blobs () {
- __git_guard $* "[[:xdigit:]]#" 'blob id'
+ __git_objects
}
(( $+functions[__git_stages] )) ||
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author