zsh-workers
 help / color / mirror / code / Atom feed
* Add --cached to git-diff completion
@ 2007-10-05 23:13 Mikael Magnusson
  2007-10-06  1:10 ` Clint Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2007-10-05 23:13 UTC (permalink / raw)
  To: zsh-workers

Not sure how to make _arguments do different things based on options given,for
git-diff ... -- <tab>
it should complete files
and for
git-diff --cached <tab>
it should only complete one commit, not two, since we're diffing
against the index
but i think the following change is still better than not. (don't add
--cached to $diff_args
since that is also used for git-diff-index and others where the
description is different).

diff --git a/Completion/Unix/Command/_git
b/Completion/Unix/Command/_git
index 3a365e5..9dcb481 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1585,6 +1585,7 @@ __git_zstyle_default
':completion::complete:git-commit:argument-rest:*' ignore-l
 _git-diff () {
   _arguments -S \
     $diff_args \
+    '--cached[show diff between index and named commit]' \
     '::original revision:__git_commits' \
     '::new revision:__git_commits' \
     '*::index file:__git_modified_files' && ret=0


-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-06  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-05 23:13 Add --cached to git-diff completion Mikael Magnusson
2007-10-06  1:10 ` 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).