##// END OF EJS Templates
color: cleanup 'debugcolor' logic...
Pierre-Yves David -
r31121:8fc55bbd default
parent child Browse files
Show More
@@ -357,26 +357,22 b' def debugcolor(ui, repo, **opts):'
357 return _debugdisplaycolor(ui)
357 return _debugdisplaycolor(ui)
358
358
359 def _debugdisplaycolor(ui):
359 def _debugdisplaycolor(ui):
360 oldstyle = ui._styles.copy()
360 ui = ui.copy()
361 try:
361 ui._styles.clear()
362 ui._styles.clear()
362 for effect in color._effects.keys():
363 for effect in color._effects.keys():
363 ui._styles[effect] = effect
364 ui._styles[effect] = effect
364 if ui._terminfoparams:
365 if ui._terminfoparams:
365 for k, v in ui.configitems('color'):
366 for k, v in ui.configitems('color'):
366 if k.startswith('color.'):
367 if k.startswith('color.'):
367 ui._styles[k] = k[6:]
368 ui._styles[k] = k[6:]
368 elif k.startswith('terminfo.'):
369 elif k.startswith('terminfo.'):
369 ui._styles[k] = k[9:]
370 ui._styles[k] = k[9:]
370 ui.write(_('available colors:\n'))
371 ui.write(_('available colors:\n'))
371 # sort label with a '_' after the other to group '_background' entry.
372 # sort label with a '_' after the other to group '_background' entry.
372 items = sorted(ui._styles.items(),
373 items = sorted(ui._styles.items(),
373 key=lambda i: ('_' in i[0], i[0], i[1]))
374 key=lambda i: ('_' in i[0], i[0], i[1]))
374 for colorname, label in items:
375 for colorname, label in items:
375 ui.write(('%s\n') % colorname, label=label)
376 ui.write(('%s\n') % colorname, label=label)
377 finally:
378 ui._styles.clear()
379 ui._styles.update(oldstyle)
380
376
381 def _debugdisplaystyle(ui):
377 def _debugdisplaystyle(ui):
382 ui.write(_('available style:\n'))
378 ui.write(_('available style:\n'))
General Comments 0
You need to be logged in to leave comments. Login now