comparison README.txt @ 116:06f5eba2f588

perfect, except testing multiline output
author catherine@Elli.myhome.westell.com
date Sat, 25 Oct 2008 21:07:23 -0400
parents 0820c42ea23e
children fe47c5b269cc
comparison
equal deleted inserted replaced
115:0820c42ea23e 116:06f5eba2f588
1 ----
2 cmd2
3 ----
4
5 :Author: Catherine Devlin, http://catherinedevlin.blogspot.com
6
1 `cmd2` is a tool for writing command-line interactive applications. It is based on the Python Standard Library's `cmd` module, and can be used anyplace `cmd` is used simply by importing `cmd2` instead. 7 `cmd2` is a tool for writing command-line interactive applications. It is based on the Python Standard Library's `cmd` module, and can be used anyplace `cmd` is used simply by importing `cmd2` instead.
2 8
3 `cmd2` provides the following features, in addition to those already existing in `cmd`: 9 `cmd2` provides the following features, in addition to those already existing in `cmd`:
4 10
5 - Searchable command history 11 - Searchable command history
10 - Settable environment parameters 16 - Settable environment parameters
11 - Parsing commands with flags 17 - Parsing commands with flags
12 - Redirection to file with `>`, `>>`; input from file with `<` 18 - Redirection to file with `>`, `>>`; input from file with `<`
13 - Bare '>', '>>' with no filename send output to paste buffer 19 - Bare '>', '>>' with no filename send output to paste buffer
14 - Pipe output to shell commands with `|` 20 - Pipe output to shell commands with `|`
21 - Simple transcript-based application testing
15 22
16 Instructions for implementing each feature follow. 23 Instructions for implementing each feature follow.
17 24
18 - Searchable command history 25 - Searchable command history
19 26
55 if opts.myoption: 62 if opts.myoption:
56 ... 63 ...
57 64
58 See Python standard library's `optparse` documentation: http://docs.python.org/lib/optparse-defining-options.html 65 See Python standard library's `optparse` documentation: http://docs.python.org/lib/optparse-defining-options.html
59 66
60 - Catherine Devlin, http://catherinedevlin.blogspot.com
61
62 cmd2 can be installed with `easy_install cmd2` 67 cmd2 can be installed with `easy_install cmd2`
63 68
64 Cheese Shop page: http://pypi.python.org/pypi/cmd2 69 Cheese Shop page: http://pypi.python.org/pypi/cmd2
65 70
66 Example cmd2 application (example/example.py) :: 71 Example cmd2 application (example/example.py) ::
110 else: 115 else:
111 app = CmdLineApp() 116 app = CmdLineApp()
112 app.cmdloop() 117 app.cmdloop()
113 118
114 The following is a sample session running example.py. 119 The following is a sample session running example.py.
115 Thanks to TestMyAppCase(Cmd2TestCase), it also serves as a test 120 Thanks to `TestMyAppCase(Cmd2TestCase)`, it also serves as a test
116 suite for example.py when saved as `exampleSession.txt`. 121 suite for example.py when saved as `exampleSession.txt`.
117 Running `python example.py -t` will run all the commands in the 122 Running `python example.py -t` will run all the commands in the
118 transcript against example.py, verifying that the output produced 123 transcript against `example.py`, verifying that the output produced
119 is as expected. 124 matches the transcript.
120 125
121 exampleSession.txt:: 126 example/exampleSession.txt::
122 127
123 (Cmd) help 128 (Cmd) help
124 129
125 Documented commands (type help <topic>): 130 Documented commands (type help <topic>):
126 ======================================== 131 ========================================