comparison cmd2.py @ 126:197a312f2656

push to get to v 126
author catherine@dellzilla
date Wed, 05 Nov 2008 14:16:24 -0500
parents fad4dde06be8
children 8def9dec155f 31674148b13c
comparison
equal deleted inserted replaced
125:be7c2f2874a9 126:197a312f2656
17 is used in place of `print`. The standard library's `cmd` module is 17 is used in place of `print`. The standard library's `cmd` module is
18 written to use `self.stdout.write()`, 18 written to use `self.stdout.write()`,
19 19
20 - Catherine Devlin, Jan 03 2008 - catherinedevlin.blogspot.com 20 - Catherine Devlin, Jan 03 2008 - catherinedevlin.blogspot.com
21 21
22 mercurial repository at http://www.assembla.com/wiki/show/python-cmd2
22 CHANGES: 23 CHANGES:
23 As of 0.3.0, options should be specified as `optparse` options. See README.txt. 24 As of 0.3.0, options should be specified as `optparse` options. See README.txt.
24 flagReader.py options are still supported for backward compatibility 25 flagReader.py options are still supported for backward compatibility
25 """ 26 """
26 import cmd, re, os, sys, optparse, subprocess, tempfile, pyparsing, doctest, unittest 27 import cmd, re, os, sys, optparse, subprocess, tempfile, pyparsing, doctest, unittest
27 from optparse import make_option 28 from optparse import make_option
28 __version__ = '0.4.1' 29 __version__ = '0.4.2'
29 30
30 class OptionParser(optparse.OptionParser): 31 class OptionParser(optparse.OptionParser):
31 def exit(self, status=0, msg=None): 32 def exit(self, status=0, msg=None):
32 self.values._exit = True 33 self.values._exit = True
33 if msg: 34 if msg:
772 lines = [] 773 lines = []
773 for line in s.splitlines(): 774 for line in s.splitlines():
774 line = line.rstrip() 775 line = line.rstrip()
775 if line.startswith(bareprompt): 776 if line.startswith(bareprompt):
776 line = line.replace(bareprompt, '', 1) 777 line = line.replace(bareprompt, '', 1)
778 lines.append(line)
777 return '\n'.join(lines).strip() 779 return '\n'.join(lines).strip()
778 def tearDown(self): 780 def tearDown(self):
779 if self.CmdApp: 781 if self.CmdApp:
780 self.outputTrap.tearDown() 782 self.outputTrap.tearDown()
781 783