# HG changeset patch # User cat@eee # Date 1266030904 18000 # Node ID 49bea7cab179185c7141be55daed984ccb4bfabe # Parent 6306edc46a6e43ad5a8ce5530eef78b5221be098 doc refreshing refresh.bash diff -r 6306edc46a6e -r 49bea7cab179 cmd2.py --- 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 = [] diff -r 6306edc46a6e -r 49bea7cab179 docs/freefeatures.rst --- 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 ======================== diff -r 6306edc46a6e -r 49bea7cab179 docs/index.rst --- 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: diff -r 6306edc46a6e -r 49bea7cab179 docs/refresh.bash --- /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" diff -r 6306edc46a6e -r 49bea7cab179 docs/unfreefeatures.rst --- 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! +