mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
parent
9badc86fb7
commit
465fdc02a3
3 changed files with 34 additions and 9 deletions
10
Lib/cmd.py
10
Lib/cmd.py
|
@ -310,10 +310,10 @@ class Cmd:
|
|||
names = self.get_names()
|
||||
cmds_doc = []
|
||||
cmds_undoc = []
|
||||
help = {}
|
||||
topics = set()
|
||||
for name in names:
|
||||
if name[:5] == 'help_':
|
||||
help[name[5:]]=1
|
||||
topics.add(name[5:])
|
||||
names.sort()
|
||||
# There can be duplicates if routines overridden
|
||||
prevname = ''
|
||||
|
@ -323,16 +323,16 @@ class Cmd:
|
|||
continue
|
||||
prevname = name
|
||||
cmd=name[3:]
|
||||
if cmd in help:
|
||||
if cmd in topics:
|
||||
cmds_doc.append(cmd)
|
||||
del help[cmd]
|
||||
topics.remove(cmd)
|
||||
elif getattr(self, name).__doc__:
|
||||
cmds_doc.append(cmd)
|
||||
else:
|
||||
cmds_undoc.append(cmd)
|
||||
self.stdout.write("%s\n"%str(self.doc_leader))
|
||||
self.print_topics(self.doc_header, cmds_doc, 15,80)
|
||||
self.print_topics(self.misc_header, list(help.keys()),15,80)
|
||||
self.print_topics(self.misc_header, sorted(topics),15,80)
|
||||
self.print_topics(self.undoc_header, cmds_undoc, 15,80)
|
||||
|
||||
def print_topics(self, header, cmds, cmdlen, maxcol):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue