diff hgext/color.py @ 31104:8346b2f09e79

color: add the definition of '--color' in core If we want to be able to move the initialisation in core, we need core to be aware of that '--color' flag at all time. So we now have the definition in core. That flag is currently unprocessed without the extensions (will be fixed soon). In addition the default value for this flag in core is 'never'. Enabling the extensions change that default value to 'auto'.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 21 Feb 2017 18:09:21 +0100
parents c1997c5d1ae3
children 45be7590301d
line wrap: on
line diff
--- a/hgext/color.py	Tue Feb 21 17:51:43 2017 +0100
+++ b/hgext/color.py	Tue Feb 21 18:09:21 2017 +0100
@@ -198,12 +198,13 @@
     extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
 
 def extsetup(ui):
-    commands.globalopts.append(
-        ('', 'color', 'auto',
-         # i18n: 'always', 'auto', 'never', and 'debug' are keywords
-         # and should not be translated
-         _("when to colorize (boolean, always, auto, never, or debug)"),
-         _('TYPE')))
+    # change default color config
+    for idx, entry in enumerate(commands.globalopts):
+        if entry[1] == 'color':
+            patch = ('auto', entry[3].replace(' (EXPERIMENTAL)', ''))
+            new = entry[:2] + patch + entry[4:]
+            commands.globalopts[idx] = new
+            break
 
 @command('debugcolor',
         [('', 'style', None, _('show all configured styles'))],