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