changeset 338:92a15405ed8a

example changing print to 2.6'
author catherine@Drou
date Tue, 16 Feb 2010 11:22:45 -0500
parents 2ce34ad4e520
children 6c397f0865c7
files docs/pycon2010/pirate2.py docs/pycon2010/pirate3.py docs/pycon2010/pirate4.py docs/pycon2010/pirate5.py docs/pycon2010/pirate6.py docs/settingchanges.rst
diffstat 6 files changed, 37 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/docs/pycon2010/pirate2.py	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/pycon2010/pirate2.py	Tue Feb 16 11:22:45 2010 -0500
@@ -6,11 +6,11 @@
     def do_loot(self, arg):
         'Seize booty frrrom a passing ship.'
         self.gold += 1
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold))
     def do_drink(self, arg):
         'Drown your sorrrows in rrrum.'
         self.gold -= 1
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold))
 
 pirate = Pirate()
 pirate.cmdloop()
\ No newline at end of file
--- a/docs/pycon2010/pirate3.py	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/pycon2010/pirate3.py	Tue Feb 16 11:22:45 2010 -0500
@@ -10,7 +10,7 @@
         'Drown your sorrrows in rrrum.'        
         self.gold -= 1
     def postcmd(self, stop, line):                         
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold))
 
 pirate = Pirate()
 pirate.cmdloop()
\ No newline at end of file
--- a/docs/pycon2010/pirate4.py	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/pycon2010/pirate4.py	Tue Feb 16 11:22:45 2010 -0500
@@ -14,10 +14,10 @@
             self.gold -= int(arg)
         except:
             if arg:
-                print '''What's "{0}"?  I'll take rrrum.'''.format(arg)
+                print('''What's "{0}"?  I'll take rrrum.'''.format(arg))
             self.gold -= 1            
     def postcmd(self, stop, line):
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold))
 
 pirate = Pirate()
 pirate.cmdloop()
\ No newline at end of file
--- a/docs/pycon2010/pirate5.py	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/pycon2010/pirate5.py	Tue Feb 16 11:22:45 2010 -0500
@@ -14,16 +14,16 @@
             self.gold -= int(arg)
         except:
             if arg:
-                print '''What's "{0}"?  I'll take rrrum.'''.format(arg)
+                print('''What's "{0}"?  I'll take rrrum.'''.format(arg))
             self.gold -= 1                  
     def postcmd(self, stop, line):
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold))
         if self.gold < 0:
-            print "Off to debtorrr's prrrison.  Game overrr."
+            print("Off to debtorrr's prrrison.  Game overrr.")
             return True
         return stop
     def do_quit(self, arg):
-        print "Quiterrr!"
+        print("Quiterrr!")
         return True    
 
 pirate = Pirate()
--- a/docs/pycon2010/pirate6.py	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/pycon2010/pirate6.py	Tue Feb 16 11:22:45 2010 -0500
@@ -1,11 +1,11 @@
-from cmd2 import Cmd
+from cmd import Cmd
 # prompts and defaults
 
 class Pirate(Cmd):
     gold = 3
     prompt = 'arrr> '
     def default(self, line):
-        print 'What mean ye by "{0}"?'.format(line)
+        print('What mean ye by "{0}"?'.format(line))
     def do_loot(self, arg):
         'Drown your sorrrows in rrrum.'                
         self.gold += 1
@@ -17,16 +17,16 @@
             self.gold -= int(arg)
         except:
             if arg:
-                print '''What's "{0}"?  I'll take rrrum.'''.format(arg)
+                print('''What's "{0}"?  I'll take rrrum.'''.format(arg))
             self.gold -= 1            
     def postcmd(self, stop, line):
-        print 'Now we gots {0} doubloons'.format(self.gold)
+        print('Now we gots {0} doubloons'.format(self.gold)
         if self.gold < 0:
-            print "Off to debtorrr's prrrison.  Game overrr."
+            print("Off to debtorrr's prrrison.  Game overrr.")
             return True
         return stop
     def do_quit(self, arg):
-        print "Quiterrr!"
+        print("Quiterrr!")
         return True    
 
 pirate = Pirate()
--- a/docs/settingchanges.rst	Tue Feb 16 11:02:56 2010 -0500
+++ b/docs/settingchanges.rst	Tue Feb 16 11:22:45 2010 -0500
@@ -4,7 +4,8 @@
 
 Several aspects of a ``cmd2`` application's behavior
 can be controlled simply by setting attributes of ``App``.
-
+A parameter can also be changed at runtime by the user *if* 
+its name is included in the dictionary ``app.settable``.
 (To define your own user-settable parameters, see :ref:`parameters`)
 
 Case-insensitivity
@@ -17,22 +18,6 @@
 Whether or not you set ``case_insensitive``, *please do not* define
 command method names with any uppercase letters.  ``cmd2`` will probably
 do something evil if you do.
-
-Multiline commands
-==================
-
-Like cmd_, ``cmd2`` assumes that a line break ends any command.
-However, ``App.multilineCommands`` is a list of commands that are assumed to span
-multiple lines.  For these commands 
-
-``cmd2.Cmd.multilineCommands`` defaults to [], so you may set your own list
-of multiline command names (without ``do_``)::
-
-    class App(Cmd):
-        multilineCommands = ['lenghtycommand']
-        def do_lengthycommand(self, args):
-            # ...          
-
  
 Shortcuts
 =========
@@ -91,6 +76,13 @@
 Setting ``App.timing`` to ``True`` outputs timing data after
 every application command is executed.  |settable|
 
+Echo
+====
+
+If ``True``, each command the user issues will be repeated
+to the screen before it is executed.  This is particularly
+useful when running scripts.
+
 Debug
 =====
 
@@ -101,13 +93,6 @@
                         during application execution.  
                         (See :ref:`parameters`)
 
-Settability
-===========
-
-If you wish the user to be able to set one of these
-application-controlling attributes while the application 
-is running, add its name to ``App.settable``.  See
-:ref:`parameters`.
 
 Other user-settable parameters
 ==============================
@@ -117,4 +102,17 @@
 with::
 
   (Cmd) set --long
+  abbrev: True                   # Accept abbreviated commands
+  case_insensitive: True         # upper- and lower-case both OK
+  colors: True                   # Colorized output (*nix only)
+  continuation_prompt: >         # On 2nd+ line of input
+  debug: False                   # Show full error stack on error
+  default_file_name: command.txt # for ``save``, ``load``, etc.
+  echo: False                    # Echo command issued into output
+  editor: gedit                  # Program used by ``edit``
+  feedback_to_output: False      # include nonessentials in `|`, `>` results
+  prompt: (Cmd)                  # 
+  quiet: False                   # Don't print nonessential feedback
+  timing: False                  # Report execution times
+