diff cmd2.py @ 90:1cd189536e90

going to improve Save
author catherine@Elli.myhome.westell.com
date Wed, 03 Sep 2008 17:32:49 -0400
parents bd0adc37f3cc
children 88f2aa240af1
line wrap: on
line diff
--- a/cmd2.py	Thu Aug 07 13:49:30 2008 -0400
+++ b/cmd2.py	Wed Sep 03 17:32:49 2008 -0400
@@ -194,7 +194,7 @@
         self.stdout.write("Single-key shortcuts for other commands:\n%s\n" % (result))
 
     terminatorPattern = (pyparsing.Literal(';') ^ pyparsing.Literal('\n\n')) \
-                  ('terminator')
+                  ^ (pyparsing.Literal('\nEOF') + pyparsing.lineEnd) ('terminator')
     argSeparatorPattern = pyparsing.Word(pyparsing.printables)('command') \
                           + pyparsing.SkipTo(pyparsing.StringEnd())('args')
     filenamePattern = pyparsing.Word(pyparsing.alphanums + '#$-_~{},.!:\\/')
@@ -514,7 +514,7 @@
     def do_save(self, fname=None):
         """Saves most recent command to a file."""
         
-        if fname is None:
+        if not fname:
             fname = self.defaultFileName
         try:
             f = open(fname, 'w')