annotate docs/settingchanges.rst @ 324:21584174d865

make SHOW TABLES work
author catherine@dellzilla
date Thu, 11 Feb 2010 16:07:24 -0500
parents a08c50b7d3d3
children 4172feeddf76
rev   line source
315
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
1 =========================================
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
2 Features requiring only parameter changes
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
3 =========================================
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
4
324
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
5 Several aspects of a ``cmd2`` application's behavior
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
6 can be controlled simply by setting attributes of ``App``.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
7
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
8 (To define your own user-settable parameters, see :ref:`parameters`
315
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
9
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
10 Case-insensitivity
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
11 ==================
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
12
324
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
13 By default, all ``cmd2`` command names are case-insensitive;
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
14 ``sing the blues`` and ``SiNg the blues`` are equivalent. To change this,
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
15 set ``App.case_insensitive`` to False.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
16
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
17 Whether or not you set ``case_insensitive``, *please do not* define
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
18 command method names with any uppercase letters. ``cmd2`` will probably
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
19 do something evil if you do.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
20
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
21 Multiline commands
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
22 ==================
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
23
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
24 Like cmd_, ``cmd2`` assumes that a line break ends any command.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
25 However, ``App.multilineCommands`` is a list of commands that are assumed to span
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
26 multiple lines. For these commands
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
27
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
28 ``cmd2.Cmd.multilineCommands`` defaults to [], so you may set your own list
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
29 of multiline command names (without ``do_``)::
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
30
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
31 class App(Cmd):
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
32 multilineCommands = ['lenghtycommand']
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
33 def do_lengthycommand(self, args):
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
34 # ...
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
35
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
36
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
37 Shortcuts
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
38 =========
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
39
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
40 Special-character shortcuts for common commands can make life more convenient for your
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
41 users. Shortcuts are used without a space separating them from their arguments,
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
42 like ``!ls``. By default, the following shortcuts are defined:
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
43
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
44 ``?``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
45 help
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
46
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
47 ``!``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
48 shell: run as OS-level command
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
49
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
50 ``@``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
51 load script file
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
52
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
53 ``@@``
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
54 load script file; filename is relative to current script location
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
55
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
56 To define more shortcuts, update the dict ``App.shortcuts`` with the
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
57 {'shortcut': 'command_name'} (omit ``do_``)::
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
58
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
59 class App(Cmd2):
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
60 Cmd2.shortcuts.update({'*': 'sneeze', '~': 'squirm'})
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
61
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
62 Timing
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
63 ======
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
64
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
65 Setting ``App.timing`` to ``True`` outputs timing data after
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
66 every application command is executed. |settable|
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
67
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
68 Debug
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
69 =====
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
70
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
71 Setting ``App.debug`` to ``True`` will produce detailed error stacks
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
72 whenever the application generates an error. |settable|
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
73
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
74 .. |settable| replace:: The user can ``set`` this parameter
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
75 during application execution.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
76 (See :ref:`parameters`)
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
77
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
78 .. _quiet:
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
79
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
80 Quiet
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
81 =====
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
82
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
83 Controls whether ``self.pfeedback('message')`` output is suppressed;
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
84 useful for non-essential feedback that the user may not always want
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
85 to read. Only relevant if :ref:`outputters` are used.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
86
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
87 Settability
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
88 ===========
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
89
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
90 If you wish the user to be able to set one of these
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
91 application-controlling attributes while the application
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
92 is running, add its name to ``App.settable``. See
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
93 :ref:`parameters`.
21584174d865 make SHOW TABLES work
catherine@dellzilla
parents: 315
diff changeset
94
315
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
95 Abbreviated commands
a08c50b7d3d3 doc skeleton
cat@eee
parents:
diff changeset
96 ====================