Mercurial > hg
comparison hgext/color.py @ 31110:7fec37746417
color: add a 'ui.color' option to control color behavior
This new option control whether or not color will be used. It mirror the behavior
of '--color'. I usually avoid adding new option to '[ui]' as the section is
already filled with many option. However, I feel like 'color' is central enough
to deserves a spot in this '[ui]' section.
For now the option is not documented so it is still marked as experimental. Once
it get documented and official, we should be able to deprecate the color
extensions.
There is more cleanup to do before that documentation is written, but we need
this option early to made them. Having that option will allow for more cleanup
of the initialisation process and proper separation between color
configuration.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 25 Feb 2017 19:44:23 +0100 |
parents | 45be7590301d |
children | 268caf97c38f |
comparison
equal
deleted
inserted
replaced
31109:53230c5bb273 | 31110:7fec37746417 |
---|---|
185 # leave the attribute unspecified. | 185 # leave the attribute unspecified. |
186 testedwith = 'ships-with-hg-core' | 186 testedwith = 'ships-with-hg-core' |
187 | 187 |
188 def extsetup(ui): | 188 def extsetup(ui): |
189 # change default color config | 189 # change default color config |
190 color._enabledbydefault = True | |
190 for idx, entry in enumerate(commands.globalopts): | 191 for idx, entry in enumerate(commands.globalopts): |
191 if entry[1] == 'color': | 192 if entry[1] == 'color': |
192 patch = ('auto', entry[3].replace(' (EXPERIMENTAL)', '')) | 193 patch = (entry[3].replace(' (EXPERIMENTAL)', ''),) |
193 new = entry[:2] + patch + entry[4:] | 194 new = entry[:3] + patch + entry[4:] |
194 commands.globalopts[idx] = new | 195 commands.globalopts[idx] = new |
195 break | 196 break |
196 | 197 |
197 @command('debugcolor', | 198 @command('debugcolor', |
198 [('', 'style', None, _('show all configured styles'))], | 199 [('', 'style', None, _('show all configured styles'))], |