comparison mercurial/commands.py @ 9537:460e410c39be

commands: simpler sort of help topic names
author Martin Geisler <mg@lazybytes.net>
date Sun, 04 Oct 2009 10:17:01 +0200
parents e2fd9b62349b
children cad36e496640
comparison
equal deleted inserted replaced
9536:f04d17912441 9537:460e410c39be
1617 1617
1618 if not name: 1618 if not name:
1619 ui.write(_("\nadditional help topics:\n\n")) 1619 ui.write(_("\nadditional help topics:\n\n"))
1620 topics = [] 1620 topics = []
1621 for names, header, doc in help.helptable: 1621 for names, header, doc in help.helptable:
1622 names = [(-len(name), name) for name in names] 1622 topics.append((sorted(names, key=len, reverse=True)[0], header))
1623 names.sort()
1624 topics.append((names[0][1], header))
1625 topics_len = max([len(s[0]) for s in topics]) 1623 topics_len = max([len(s[0]) for s in topics])
1626 for t, desc in topics: 1624 for t, desc in topics:
1627 ui.write(" %-*s %s\n" % (topics_len, t, desc)) 1625 ui.write(" %-*s %s\n" % (topics_len, t, desc))
1628 1626
1629 if opt_output: 1627 if opt_output: