Mercurial > python-cmd2
diff docs/freefeatures.rst @ 346:49dd1ce6cfd6
quitting after invocation commands
author | catherine@Drou |
---|---|
date | Tue, 16 Feb 2010 15:47:17 -0500 |
parents | 6fe1e75e3a67 |
children | 52ab96d4f179 |
line wrap: on
line diff
--- a/docs/freefeatures.rst Tue Feb 16 15:13:11 2010 -0500 +++ b/docs/freefeatures.rst Tue Feb 16 15:47:17 2010 -0500 @@ -42,6 +42,23 @@ (Cmd) speak it was /* not */ delicious! # Yuck! it was delicious! +Commands at invocation +====================== + +You can send commands to your app as you invoke it by +including them as extra arguments to the program. +``cmd2`` interprets each argument as a separate +command, so you should enclose each command in +quotation marks if it is more than a one-word command. + +:: + + cat@eee:~/proj/cmd2/example$ python example.py "say hello" "say Gracie" quit + hello + Gracie + cat@eee:~/proj/cmd2/example$ + + Output redirection ================== @@ -58,22 +75,6 @@ .. _pywin32:: http://sourceforge.net/projects/pywin32/ .. _xclip:: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/ -Commands at invocation -====================== - -You can send commands to your app as you invoke it by -including them as extra arguments to the program. -``cmd2`` interprets each argument as a separate -command, so you should enclose each command in -quotation marks if it is more than a one-word command. - -:: - - cat@eee:~/proj/cmd2/example$ python example.py "say hello" "say Gracie" quit - hello - Gracie - cat@eee:~/proj/cmd2/example$ - Python ====== @@ -172,4 +173,12 @@ Transcript-based testing ======================== -If a ``cmd2``-based application is invoked with --test \ No newline at end of file +If the entire transcript (input and output) of a successful session of +a ``cmd2``-based app is copied from the screen and pasted into a text +file, ``transcript.txt``, then a transcript test can be run against it:: + + python app.py --test transcript.txt + +Any deviations between the output prescribed in ``transcript.txt`` and +the actual output from a fresh run of the application will be reported +as a unit test failure.