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

Re: [PATCH] vcs_info: Use ‘command’ prefix to call version control programs



Manfred Lotz wrote:
[...]
> I agree there are use-cases for a wrapper function. :-)
>
> Although in my case I could fix it easily in my function svn() because
> I always issue a debug message to stdout (in this case stderr would
> be better I have to admit) which makes normal parsing of the svn command
> fail if function svn gets called instead of command svn. After removing
> it all is fine now.

You can keep your function if you do this (as Daniel suggested):

    zstyle ':vcs_info:svn:*' command =svn

This assumes, you have the EQUALS option set to make the =svn expansion
work (this is the default behaviour of zsh). You could otherwise do
this:

    zstyle ':vcs_info:svn:*' command ${commands[svn]}

> Nevertheless, I think a wrapper function isn't illegal and shouldn't
> fail. 

If you change its behaviour in incompatible ways, there is no way to
make this work while still allowing the use of wrapper functions within
vcs_info.

Either your wrapper behaves like the original program would for normal
program invocations or vcs_info always uses the command instead of any
functions that may be defined. You can't have it both ways.

Anyway. I think using an explicit ‘command’ style with incompatible
wrappers is the best way to ensure functionality as well as backwards
compatibility.


Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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