diff options
author | Sam Denton <samwyse@gmail.com> | 2022-05-03 22:36:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 21:36:52 -0600 |
commit | 465fdc02a3c41cfe209e280c32a77c48e3a966fa (patch) | |
tree | 86f82e153e8e180ad9a1d3fe01583ef03e03c089 /Lib/cmd.py | |
parent | 9badc86fb76b48fdd7e335eef850c7a508af5266 (diff) | |
download | cpython-465fdc02a3c41cfe209e280c32a77c48e3a966fa.tar.gz cpython-465fdc02a3c41cfe209e280c32a77c48e3a966fa.zip |
gh-67248: cmd: Sort miscellaneous help topics (#92254)
Closes #67248
Diffstat (limited to 'Lib/cmd.py')
-rw-r--r-- | Lib/cmd.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/cmd.py b/Lib/cmd.py index 859e91096d8..88ee7d3ddc4 100644 --- a/Lib/cmd.py +++ b/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): |