annotate docs/freefeatures.rst @ 325:4172feeddf76

want to incorporate run() for tests - not yet working
author catherine@dellzilla
date Thu, 11 Feb 2010 17:03:45 -0500
parents 21584174d865
children 7b2bca3951a7
rev   line source
314
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
1 ===================================
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
2 Features requiring no modifications
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
3 ===================================
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
4
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
5 These features are provided "for free" to a cmd_-based application
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
6 simply by replacing ``import cmd`` with ``import cmd2 as cmd``.
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
7
315
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
8 Script files
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
9 ============
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
10
325
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
11 Commands can be loaded and run from text files.
315
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
12
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
13 .. automethod:: cmd2.Cmd.do_load
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
14
325
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
15 .. automethod:: cmd2.Cmd.do_save
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
16
315
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
17 Output redirection
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
18 ==================
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
19
324
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
20 As in a Unix shell, output of a command can be redirected:
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
21
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
22 - sent to a file with ``>``, as in ``mycommand args > filename.txt``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
23 - piped (``|``) as input to operating-system commands, as in
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
24 ``mycommand args | wc``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
25 - sent to the paste buffer, ready for the next Copy operation, by
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
26 ending with a bare ``>``, as in ``mycommand args >``.. Redirecting
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
27 to paste buffer requires software to be installed on the operating
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
28 system, pywin32_ on Windows or xclip_ on *nix.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
29
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
30 .. _pywin32:: http://sourceforge.net/projects/pywin32/
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
31 .. _xclip:: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
32
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
33
325
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
34 Commands at invocation
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
35 ======================
324
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
36
325
4172feeddf76 want to incorporate run() for tests - not yet working
catherine@dellzilla
parents: 324
diff changeset
37 TODO: broken!?
315
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
38
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
39 Python
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
40 ======
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
41
314
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
42 Searchable command history
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
43 ==========================
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
44
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
45 All cmd_-based applications have access to previous commands with
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
46 the up- and down- cursor keys.
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
47
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
48 All cmd_-based applications on systems with the ``readline`` module
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
49 also provide `bash-like history list editing`_.
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
50
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
51 .. _`bash-like history list editing`: http://www.talug.org/events/20030709/cmdline_history.html
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
52
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
53 ``cmd2`` makes a third type of history access available, consisting of these commands:
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
54
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
55 .. automethod:: cmd2.Cmd.do_history
0687bb650118 begin new docs
catherine@dellzilla
parents:
diff changeset
56
315
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
57 Transcript-based testing
a08c50b7d3d3 doc skeleton
cat@eee
parents: 314
diff changeset
58 ========================