changeset 21249:2b8697e20978

color: declare command using decorator
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 21:48:10 -0700
parents 48e859e30cbf
children 8d354d58147c
files hgext/color.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Sun May 04 21:46:49 2014 -0700
+++ b/hgext/color.py	Sun May 04 21:48:10 2014 -0700
@@ -111,10 +111,12 @@
 
 import os
 
-from mercurial import commands, dispatch, extensions, ui as uimod, util
+from mercurial import cmdutil, commands, dispatch, extensions, ui as uimod, util
 from mercurial import templater, error
 from mercurial.i18n import _
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
 # start and stop parameters for effects
@@ -440,6 +442,7 @@
          _("when to colorize (boolean, always, auto, or never)"),
          _('TYPE')))
 
+@command('debugcolor', [], 'hg debugcolor')
 def debugcolor(ui, repo, **opts):
     global _styles
     _styles = {}
@@ -579,8 +582,3 @@
         finally:
             # Explicitly reset original attributes
             _kernel32.SetConsoleTextAttribute(stdout, origattr)
-
-cmdtable = {
-    'debugcolor':
-        (debugcolor, [], ('hg debugcolor'))
-}