RFC: Coloured output in bazaar core

Russ Brown pickscrape at gmail.com
Sun Aug 3 05:54:35 BST 2008

Hash: SHA1

I had a discussion with lifeless a few days back about colored output
functionality in bazaar core.

I have been working on adding colour to the diffstat plugin and wanted
to make it work in a way that would be consistent with any future core
support for it.

The conclusion to the discussion was to start with a single
configuration value in bazaar.conf which would enable or disable colour
for all supporting commands, defaulting to off:

[colour|color] = <Boolean>

I have just added support to the diffstat plugin to support this config
entry, though there is a bit more code in there than there would be if
support was in core (handling both spellings, parsing the boolean etc),
but it does work.

What would it take to get support for this option added to bzr core?
- From my limited experience of bzrlib, it looks to me like the following
would be a good start:

 * A get_colours_on() method (or similarly named) somewhere in
   bzrlib.config which defaults to False. I'm not entirely sure which
   class (or classes) this needs adding to.

I think that would be all we would need to get started, but here are a
few ideas of additional things that could be added that would enhance
the feature further:

 * New global options to bzr --no-colour and --no-color which the user
   can use to disable colour output temporarily for a single execution
   without having to mess with the config file
 * Some library that can be called upon to colour up a chunk of text.

Any comments or additional ideas? If someone gives me a hint on where to
add the required code in bzrlib.config I'll submit a patch myself.


- --


Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the bazaar mailing list