changeset 332:49bea7cab179

doc refreshing refresh.bash
author cat@eee
date Fri, 12 Feb 2010 22:15:04 -0500
parents 6306edc46a6e
children 45e70737791f
files cmd2.py docs/freefeatures.rst docs/index.rst docs/refresh.bash docs/unfreefeatures.rst
diffstat 5 files changed, 57 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Fri Feb 12 21:41:17 2010 -0500
+++ b/cmd2.py	Fri Feb 12 22:15:04 2010 -0500
@@ -941,11 +941,12 @@
            the bash shell's SELECT.  Returns the item chosen.
            
            Argument ``options`` can be:
-             a single string -> will be split into one-word options
-             a list of strings -> will be offered as options
-             a list of tuples -> interpreted as (value, text), so 
-                                 that the return value can differ from
-                                 the text advertised to the user '''
+
+             | a single string -> will be split into one-word options
+             | a list of strings -> will be offered as options
+             | a list of tuples -> interpreted as (value, text), so 
+                                   that the return value can differ from
+                                   the text advertised to the user '''
         if isinstance(options, basestring):
             options = zip(options.split(), options.split())
         fulloptions = []
--- a/docs/freefeatures.rst	Fri Feb 12 21:41:17 2010 -0500
+++ b/docs/freefeatures.rst	Fri Feb 12 22:15:04 2010 -0500
@@ -152,5 +152,21 @@
   (Cmd) speak it was /* not */ delicious! # Yuck!
   it was  delicious!
   	
+Misc. pre-defined commands
+==========================
+
+Several generically useful commands are defined
+with automatically included ``do_`` methods.
+
+.. automethod:: cmd2.Cmd.do_quit
+
+.. automethod:: cmd2.Cmd.do_pause
+
+.. automethod:: cmd2.Cmd.do_shell
+
+( ``!`` is a shortcut for ``shell``; thus ``!ls``
+is equivalent to ``shell ls``.)
+
+
 Transcript-based testing
 ========================
--- a/docs/index.rst	Fri Feb 12 21:41:17 2010 -0500
+++ b/docs/index.rst	Fri Feb 12 22:15:04 2010 -0500
@@ -20,6 +20,11 @@
 
      app = App()
      app.cmdloop()
+
+These docs will refer to ``App`` as your ``cmd2.Cmd``
+subclass, and ``app`` as an instance of ``App``.  Of
+course, in your program, you may name them whatever
+you want.
      
 Contents:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/refresh.bash	Fri Feb 12 22:15:04 2010 -0500
@@ -0,0 +1,7 @@
+make html
+#scp -r build catherine@$tummy:/var/www/sqlpython
+cd _build
+zip -r cmd2_docs *
+mv cmd2_docs.zip ..
+cd ..
+echo "Upload cmd2_docs.zip to http://pypi.python.org/pypi/cmd2"
--- a/docs/unfreefeatures.rst	Fri Feb 12 21:41:17 2010 -0500
+++ b/docs/unfreefeatures.rst	Fri Feb 12 22:15:04 2010 -0500
@@ -189,3 +189,26 @@
 to read.  ``quiet`` is only relevant if 
 ``app.pfeedback`` is sometimes used.
 
+``select``
+==========
+
+``app.select`` is called from within a method (not by the user directly; it is ``app.select``, not ``app.do_select``).
+
+.. automethod:: cmd2.Cmd.select
+
+::
+
+    def do_eat(self, arg):
+        sauce = self.select('sweet salty', 'Sauce? ')
+        result = '{food} with {sauce} sauce, yum!'
+        result = result.format(food=arg, sauce=sauce)
+        self.stdout.write(result + '\n')
+
+::
+
+	(Cmd) eat wheaties
+	   1. sweet
+	   2. salty
+	Sauce? 2
+	wheaties with salty sauce, yum!
+