summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-09-11 22:33:08 (GMT)
committerGuido van Rossum <guido@python.org>1998-09-11 22:33:08 (GMT)
commit5fca6fd2d9d53a5c417fc8a811752009b0f025e4 (patch)
tree583910ec3a70b9a55e5d1361c0c92f542421287a /Lib
parentb7833d3c0c17ab55bc9be84e6a531a5da22023a8 (diff)
downloadcpython-5fca6fd2d9d53a5c417fc8a811752009b0f025e4.zip
cpython-5fca6fd2d9d53a5c417fc8a811752009b0f025e4.tar.gz
cpython-5fca6fd2d9d53a5c417fc8a811752009b0f025e4.tar.bz2
Richard Wolff's changes:
cmd.py has incorporated the changes we discussed a couple of weeks ago (a command queue, returning line from precmd, and stop from postcmd) and some changes to help that were occasioned because I wanted to inherit from pdb which inherits from cmd.py and the help routine didn't look for commands or the associated help deeply enough.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/cmd.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/cmd.py b/Lib/cmd.py
index 20c01aa..138cdb6 100644
--- a/Lib/cmd.py
+++ b/Lib/cmd.py
@@ -131,15 +131,30 @@ class Cmd:
return
func()
else:
- names = dir(self.__class__)
+ # Inheritance says we have to look in class and
+ # base classes; order is not important.
+ names = []
+ classes = [self.__class__]
+ while classes:
+ aclass = classes[0]
+ if aclass.__bases__:
+ classes = classes + list(aclass.__bases__)
+ names = names + dir(aclass)
+ del classes[0]
cmds_doc = []
cmds_undoc = []
help = {}
for name in names:
if name[:5] == 'help_':
help[name[5:]]=1
+ names.sort()
+ # There can be duplicates if routines overridden
+ prevname = ''
for name in names:
if name[:3] == 'do_':
+ if name == prevname:
+ continue
+ prevname = name
cmd=name[3:]
if help.has_key(cmd):
cmds_doc.append(cmd)