@@ -69,23 +69,23 @@ user to enter commands, which are then executed by your program.
69
69
You may want to execute commands in your program without prompting the user for any input. There are
70
70
several ways you might accomplish this task. The easiest one is to pipe commands and their arguments
71
71
into your program via standard input. You don't need to do anything to your program in order to use
72
- this technique. Here's a demonstration using the ` examples/example .py ` included in the source code
73
- of ` cmd2 ` :
72
+ this technique. Here's a demonstration using the ` examples/transcript_example .py ` included in the
73
+ source code of ` cmd2 ` :
74
74
75
- $ echo "speak -p some words" | python examples/example .py
75
+ $ echo "speak -p some words" | python examples/transcript_example .py
76
76
omesay ordsway
77
77
78
78
Using this same approach you could create a text file containing the commands you would like to run,
79
79
one command per line in the file. Say your file was called ` somecmds.txt ` . To run the commands in
80
80
the text file using your ` cmd2 ` program (from a Windows command prompt):
81
81
82
- c:\cmd2> type somecmds.txt | python.exe examples/example .py
82
+ c:\cmd2> type somecmds.txt | python.exe examples/transcript_example .py
83
83
omesay ordsway
84
84
85
85
By default, ` cmd2 ` programs also look for commands pass as arguments from the operating system
86
86
shell, and execute those commands before entering the command loop:
87
87
88
- $ python examples/example .py help
88
+ $ python examples/transcript_example .py help
89
89
90
90
Documented commands (use 'help -v' for verbose/'help <topic>' for details):
91
91
===========================================================================
@@ -99,8 +99,8 @@ example, you might have a command inside your `cmd2` program which itself accept
99
99
maybe even option strings. Say you wanted to run the ` speak ` command from the operating system
100
100
shell, but have it say it in pig latin:
101
101
102
- $ python example/example .py speak -p hello there
103
- python example .py speak -p hello there
102
+ $ python example/transcript_example .py speak -p hello there
103
+ python transcript_example .py speak -p hello there
104
104
usage: speak [-h] [-p] [-s] [-r REPEAT] words [words ...]
105
105
speak: error: the following arguments are required: words
106
106
*** Unknown syntax: -p
@@ -122,7 +122,7 @@ Check the source code of this example, especially the `main()` function, to see
122
122
Alternatively you can simply wrap the command plus arguments in quotes (either single or double
123
123
quotes):
124
124
125
- $ python example/example .py "speak -p hello there"
125
+ $ python example/transcript_example .py "speak -p hello there"
126
126
ellohay heretay
127
127
(Cmd)
128
128
@@ -148,6 +148,6 @@ quits while returning an exit code:
148
148
149
149
Here is another example using ` quit ` :
150
150
151
- $ python example/example .py "speak -p hello there" quit
151
+ $ python example/transcript_example .py "speak -p hello there" quit
152
152
ellohay heretay
153
153
$
0 commit comments