Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Fall back to file completion if nothing else works



On Mon, Jun 27, 2011 at 14:55, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:

> 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.
>

-0. As I read this, you're proposing going from 0 (or close to it?) to an
unbounded number of completion false positives.

Before such a patch, you can be sure that git <anything> <tab> will complete
something that is legal in this spot: a tag or branch name, for instance, a
file which has not yet been added to the index, a flag for this command, et
cetera.

After it, one can never know whether zsh completed a filename because that
particular filename was legal in this context, or just because it didn't
know how to complete something in the given context – the completion could
be super smart, but it wouldn't be possible to tell, since you can't know if
a completion was legal without knowing git inside and out, or from running
the command line.

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.
>

I think that sounds like a better way to enable the behaviour you seek, for
people that specifically want it.

-- 
 / Johan Sundström, http://ecmanaut.blogspot.com/


Messages sorted by: Reverse Date, Date, Thread, Author