Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Fall back to file completion if nothing else works
- X-seq: zsh-workers 29512
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: Fall back to file completion if nothing else works
- Date: Mon, 27 Jun 2011 23:55:17 +0200
- Cc: Nikolai Weibull <now@xxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author