# HG changeset patch # User catherine@cordelia # Date 1211707347 14400 # Node ID e03a8c03ac377dbaae97195152c38978b2273a4d # Parent b3200c6e576389b8a33a654022856ae1cc9e6bb7 command-line args working diff -r b3200c6e5763 -r e03a8c03ac37 cmd2.py --- a/cmd2.py Sat May 24 20:30:33 2008 -0400 +++ b/cmd2.py Sun May 25 05:22:27 2008 -0400 @@ -125,9 +125,6 @@ raise OSError, pastebufferr % ('xclip', 'On Debian/Ubuntu, install with "sudo apt-get install xclip"') setPasteBuffer = getPasteBuffer -class ExitException(Exception): - pass - class Cmd(cmd.Cmd): caseInsensitive = True multilineCommands = [] @@ -340,7 +337,7 @@ readline.set_completer(self.old_completer) except ImportError: pass - return stop + return stop def do_EOF(self, arg): return True @@ -375,7 +372,7 @@ self.stdout.write('%s: %s\n' % (param, str(getattr(self, param)))) def do_quit(self, arg): - raise ExitException + return self._STOP_AND_EXIT do_exit = do_quit do_q = do_quit @@ -507,12 +504,11 @@ self.use_rawinput = False self.prompt = self.continuationPrompt = '' stop = self.cmdloop() - # but how to detect whether to exit totally? self.stdin.close() keepstate.restore() self.lastcmd = '' - return (stop == self._STOP_AND_EXIT) - + return (stop == self._STOP_AND_EXIT) and self._STOP_AND_EXIT + def do_run(self, arg): """run [arg]: re-runs an earlier command