]> granicus.if.org Git - python/commitdiff
Bug fix: ? and ! were not full aliases for `help' and `shell' as implied in
authorEric S. Raymond <esr@thyrsus.com>
Tue, 11 Jul 2000 13:03:55 +0000 (13:03 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 11 Jul 2000 13:03:55 +0000 (13:03 +0000)
the documentation; the cases `? foo' and `! foo' failed.

Lib/cmd.py

index d0c749831e5a665eda037245fe90c3edace16182..41b229325a67da10219bef4251e90e1b46296cc4 100644 (file)
@@ -90,15 +90,15 @@ class Cmd:
 
     def onecmd(self, line):
         line = string.strip(line)
-        if line == '?':
-            line = 'help'
-        elif line == '!':
+        if not line:
+            return self.emptyline()
+        elif line[0] == '?':
+            line = 'help ' + line[1:]
+        elif line[0] == '!':
             if hasattr(self, 'do_shell'):
-                line = 'shell'
+                line = 'shell ' + line[1:]
             else:
                 return self.default(line)
-        elif not line:
-            return self.emptyline()
         self.lastcmd = line
         i, n = 0, len(line)
         while i < n and line[i] in self.identchars: i = i+1