Mercurial > python-cmd2
diff docs/freefeatures.rst @ 345:6fe1e75e3a67
transcript test wasn't running pre and post cmd hooks
author | catherine@Drou |
---|---|
date | Tue, 16 Feb 2010 15:13:11 -0500 |
parents | 49bea7cab179 |
children | 49dd1ce6cfd6 |
line wrap: on
line diff
--- a/docs/freefeatures.rst Tue Feb 16 14:05:25 2010 -0500 +++ b/docs/freefeatures.rst Tue Feb 16 15:13:11 2010 -0500 @@ -5,18 +5,6 @@ These features are provided "for free" to a cmd_-based application simply by replacing ``import cmd`` with ``import cmd2 as cmd``. -Abbreviated commands -==================== - -``cmd2`` apps will accept shortened command names -so long as there is no ambiguity. Thus, if -``do_divide`` is defined, then ``divid``, ``div``, -or even ``d`` will suffice, so long as there are -no other commands defined beginning with *divid*, -*div*, or *d*. - -This behavior can be turned off with ``app.abbrev`` (see :ref:`parameters`) - Script files ============ @@ -30,6 +18,30 @@ .. automethod:: cmd2.Cmd.do_edit +Comments +======== + +Comments are omitted from the argument list +before it is passed to a ``do_`` method. By +default, both Python-style and C-style comments +are recognized; you may change this by overriding +``app.commentGrammars`` with a different pyparsing_ +grammar. + +Comments can be useful in :ref:`script`s. Used +in an interactive session, they may indicate +mental imbalance. + +:: + + def do_speak(self, arg): + self.stdout.write(arg + '\n') + +:: + + (Cmd) speak it was /* not */ delicious! # Yuck! + it was delicious! + Output redirection ================== @@ -128,30 +140,19 @@ synonyms ``exit`` and simply ``q``). It's trivial, but it's one less thing for you to remember. -Comments -======== -Comments are omitted from the argument list -before it is passed to a ``do_`` method. By -default, both Python-style and C-style comments -are recognized; you may change this by overriding -``app.commentGrammars`` with a different pyparsing_ -grammar. +Abbreviated commands +==================== -Comments can be useful in :ref:`script`s. Used -in an interactive session, they may indicate -mental imbalance. - -:: +``cmd2`` apps will accept shortened command names +so long as there is no ambiguity. Thus, if +``do_divide`` is defined, then ``divid``, ``div``, +or even ``d`` will suffice, so long as there are +no other commands defined beginning with *divid*, +*div*, or *d*. - def do_speak(self, arg): - self.stdout.write(arg + '\n') - -:: - - (Cmd) speak it was /* not */ delicious! # Yuck! - it was delicious! - +This behavior can be turned off with ``app.abbrev`` (see :ref:`parameters`) + Misc. pre-defined commands ========================== @@ -170,3 +171,5 @@ Transcript-based testing ======================== + +If a ``cmd2``-based application is invoked with --test \ No newline at end of file