comparison 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
comparison
equal deleted inserted replaced
345:6fe1e75e3a67 346:49dd1ce6cfd6
40 :: 40 ::
41 41
42 (Cmd) speak it was /* not */ delicious! # Yuck! 42 (Cmd) speak it was /* not */ delicious! # Yuck!
43 it was delicious! 43 it was delicious!
44 44
45 Commands at invocation
46 ======================
47
48 You can send commands to your app as you invoke it by
49 including them as extra arguments to the program.
50 ``cmd2`` interprets each argument as a separate
51 command, so you should enclose each command in
52 quotation marks if it is more than a one-word command.
53
54 ::
55
56 cat@eee:~/proj/cmd2/example$ python example.py "say hello" "say Gracie" quit
57 hello
58 Gracie
59 cat@eee:~/proj/cmd2/example$
60
61
45 Output redirection 62 Output redirection
46 ================== 63 ==================
47 64
48 As in a Unix shell, output of a command can be redirected: 65 As in a Unix shell, output of a command can be redirected:
49 66
56 system, pywin32_ on Windows or xclip_ on *nix. 73 system, pywin32_ on Windows or xclip_ on *nix.
57 74
58 .. _pywin32:: http://sourceforge.net/projects/pywin32/ 75 .. _pywin32:: http://sourceforge.net/projects/pywin32/
59 .. _xclip:: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/ 76 .. _xclip:: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/
60 77
61 Commands at invocation
62 ======================
63
64 You can send commands to your app as you invoke it by
65 including them as extra arguments to the program.
66 ``cmd2`` interprets each argument as a separate
67 command, so you should enclose each command in
68 quotation marks if it is more than a one-word command.
69
70 ::
71
72 cat@eee:~/proj/cmd2/example$ python example.py "say hello" "say Gracie" quit
73 hello
74 Gracie
75 cat@eee:~/proj/cmd2/example$
76
77 Python 78 Python
78 ====== 79 ======
79 80
80 :: 81 ::
81 82
170 171
171 172
172 Transcript-based testing 173 Transcript-based testing
173 ======================== 174 ========================
174 175
175 If a ``cmd2``-based application is invoked with --test 176 If the entire transcript (input and output) of a successful session of
177 a ``cmd2``-based app is copied from the screen and pasted into a text
178 file, ``transcript.txt``, then a transcript test can be run against it::
179
180 python app.py --test transcript.txt
181
182 Any deviations between the output prescribed in ``transcript.txt`` and
183 the actual output from a fresh run of the application will be reported
184 as a unit test failure.