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

Re: Submitting vcs_info function



On Wed, 17 Sep 2008 22:18:59 +0200
Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> I've been working on this for quite some time now. vcs_info is a
> function that is able to get information about directories under
> version control. That information can be used in prompts, for example.
> 
> I am submitting this for inclusion in the next zsh release - if the
> developers deem it to be worthy. I think Functions/Misc/vcs_info would
> be a proper place.

Thanks.  This will be useful.

I'd like to suggest a slightly different interface (internally, this
wouldn't affect the use).  I think it would be best if it lived in
Functions/VCS_Info with a single central function in one file, backends in
VCS_INFO_BACKEND_<backend>, and any utility functions in other files
(though small ones could be in the main function file).  Then you don't
need to load a backend you're not using and the central function can query
backends by searching the function path for files of that name (the sort of
thing that's easy in zsh) and autoloading the function in question so you
wouldn't need an explicit list.  I'd suggest that functions for each
backend be done as arguments "VCS_INFO_BACKEND_<backend> get_data", but it
could equally be something like VCS_INFO_backend_<backend>_get_data or
anything explicit enough that wouldn't get confused with another
backend.

I'd also suggest it would be more useful to enable, rather than disable,
backends.  I tend to know which archiving systems I'm using and it's not
particular convenient to have to disable a whole series I may never even
have heard of, and which may well be extended in future versions so is a
moving target.  However, there's nothing to stop you having both with
"enable" taking preference.

It should be possible to use the new prompt colouring features in the
version that goes into the archive (%F{red}...%f), so explicit escapes can
be avoided.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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