Mercurial > hg
comparison hgext/color.py @ 30285:bb2dfc0ea5b4
color: sort output of 'debugcolor'
The previous ordering were provided by the set. The new output is more stable
and rational. In addition we have some logic to keep the '_background' version
together to help readability.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 03 Nov 2016 15:15:47 +0100 |
parents | 7556507f7197 |
children | d44c407a5999 |
comparison
equal
deleted
inserted
replaced
30284:7556507f7197 | 30285:bb2dfc0ea5b4 |
---|---|
554 if k.startswith('color.'): | 554 if k.startswith('color.'): |
555 _styles[k] = k[6:] | 555 _styles[k] = k[6:] |
556 elif k.startswith('terminfo.'): | 556 elif k.startswith('terminfo.'): |
557 _styles[k] = k[9:] | 557 _styles[k] = k[9:] |
558 ui.write(_('available colors:\n')) | 558 ui.write(_('available colors:\n')) |
559 for colorname, label in _styles.items(): | 559 # sort label with a '_' after the other to group '_background' entry. |
560 items = sorted(_styles.items(), | |
561 key=lambda i: ('_' in i[0], i[0], i[1])) | |
562 for colorname, label in items: | |
560 ui.write(('%s\n') % colorname, label=label) | 563 ui.write(('%s\n') % colorname, label=label) |
561 finally: | 564 finally: |
562 _styles = oldstyle | 565 _styles = oldstyle |
563 | 566 |
564 if os.name != 'nt': | 567 if os.name != 'nt': |