zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Fall back to file completion if nothing else works
@ 2011-06-27 21:55 Frank Terbeck
  2011-06-28  2:03 ` Johan Sundström
  2011-06-29 20:37 ` PATCH: (0/3) _git fixes and enhancements Frank Terbeck
  0 siblings, 2 replies; 24+ messages in thread
From: Frank Terbeck @ 2011-06-27 21:55 UTC (permalink / raw)
  To: zsh workers; +Cc: Nikolai Weibull

Some people have for third party add-ons to git. `annex' is one such
add-on. Currently "git annex add <tab>" does nothing, because there is
no special subcommand handling function.

_git should really fallback to file name completion in such cases. This
patch does exactly that.

I'm wondering how we should handle third party add ons to commands. _git
used provide the `user-commands' style to do stuff like this:

    % zstyle ':completion:*:*:git:*' user-commands foo:'description for foo'

You could even define `_git-foo()' to have special handling.

In fact, the current _git still mentions that in the `user-commands'
style. But the actual code is gone since the major update. I think it
should be re-added for backward compatibility.

`user-commands' is really only useful for user-specific add-ons. We
might also want to invent something so third party add-ons (which might
be distributed separately from git) could drop a _git-foo file into
$fpath to get special completion for "git fo<tab>" and "git foo <tab>".

Thoughts?
---
 Completion/Unix/Command/_git |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index e062705..2b8b8d6 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6024,6 +6024,10 @@ _git() {
         curcontext=${curcontext%:*:*}:git-$words[1]:
 
         _call_function ret _git-$words[1]
+        if (( ? != 0 )); then
+            _path_files
+            ret=$?
+        fi
         ;;
     esac
   else
-- 
1.7.5


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

end of thread, other threads:[~2011-10-27  8:07 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-27 21:55 PATCH: Fall back to file completion if nothing else works Frank Terbeck
2011-06-28  2:03 ` Johan Sundström
2011-06-28  5:17   ` Frank Terbeck
2011-06-29 21:46     ` Johan Sundström
2011-06-29 22:33       ` Frank Terbeck
2011-06-29 20:37 ` PATCH: (0/3) _git fixes and enhancements Frank Terbeck
2011-06-29 20:37   ` PATCH: (1/3) _git: Fall back to file completion if nothing else works Frank Terbeck
2011-06-29 20:37   ` PATCH: (2/3) _git: Pick up addon completions from $fpath Frank Terbeck
2011-06-29 21:15     ` Frank Terbeck
2011-06-29 20:37   ` PATCH: (3/3) _git: re-add `user-commands' support again Frank Terbeck
2011-07-22 11:54     ` Nikolai Weibull
2011-07-22 11:55     ` Nikolai Weibull
2011-07-22 12:00       ` Frank Terbeck
2011-07-22 12:48         ` Nikolai Weibull
2011-07-22 12:49           ` Frank Terbeck
2011-07-22 13:05             ` Nikolai Weibull
2011-06-29 21:30   ` PATCH: (4/3) _git-buildpackage: use a #desc: line Frank Terbeck
2011-07-20 18:11     ` Nikolai Weibull
2011-07-20 18:22       ` Frank Terbeck
2011-07-22 11:58         ` Nikolai Weibull
2011-07-22 12:01           ` Frank Terbeck
2011-06-30  9:17   ` PATCH: (5/3) _git: Make file-completion fallback optional Frank Terbeck
2011-07-22  9:35     ` Nikolai Weibull
2011-10-27  8:00       ` 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).