* Use that git-show completion in more places.
@ 2007-10-20 3:02 Mikael Magnusson
2007-10-21 17:21 ` Nikolai Weibull
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2007-10-20 3:02 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Use that git-show completion in more places.
2007-10-20 3:02 Use that git-show completion in more places Mikael Magnusson
@ 2007-10-21 17:21 ` Nikolai Weibull
0 siblings, 0 replies; 2+ messages in thread
From: Nikolai Weibull @ 2007-10-21 17:21 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh-workers
On 10/20/07, Mikael Magnusson <mikachu@gmail.com> wrote:
> This makes some completions that would just verify you typed a hex
> number complete that rev:file i added for git-show earlier.
Two issues:
1. You should retain the guard for hexadecimal digits so that users
can type SHA-1s
2. The name of the object being completed, if it is really correct to
have __git_blocks use __git_objects (for example), should still be
used
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-21 22:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-20 3:02 Use that git-show completion in more places Mikael Magnusson
2007-10-21 17:21 ` Nikolai Weibull
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).