|
1 | | -"""A generic class to build line-oriented command interpreters. |
| 1 | +""" |
| 2 | +A generic class to build line-oriented command interpreters. |
2 | 3 |
|
3 | 4 | Interpreters constructed with this class obey the following conventions: |
4 | 5 |
|
5 | 6 | 1. End of file on input is processed as the command 'EOF'. |
6 | 7 | 2. A command is parsed out of each line by collecting the prefix composed |
7 | 8 | of characters in the identchars member. |
8 | | -3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method |
| 9 | +3. A command 'foo' is dispatched to a method 'do_foo()'; the do_ method |
9 | 10 | is passed a single argument consisting of the remainder of the line. |
10 | 11 | 4. Typing an empty line repeats the last command. (Actually, it calls the |
11 | | - method `emptyline', which may be overridden in a subclass.) |
12 | | -5. There is a predefined `help' method. Given an argument `topic', it |
13 | | - calls the command `help_topic'. With no arguments, it lists all topics |
| 12 | + method 'emptyline', which may be overridden in a subclass.) |
| 13 | +5. There is a predefined 'help' method. Given an argument 'topic', it |
| 14 | + calls the command 'help_topic'. With no arguments, it lists all topics |
14 | 15 | with defined help_ functions, broken into up to three topics; documented |
15 | 16 | commands, miscellaneous help topics, and undocumented commands. |
16 | | -6. The command '?' is a synonym for `help'. The command '!' is a synonym |
17 | | - for `shell', if a do_shell method exists. |
| 17 | +6. The command '?' is a synonym for 'help'. The command '!' is a synonym |
| 18 | + for 'shell', if a do_shell method exists. |
18 | 19 | 7. If completion is enabled, completing commands will be done automatically, |
19 | 20 | and completing of commands args is done by calling complete_foo() with |
20 | 21 | arguments text, line, begidx, endidx. text is string we are matching |
|
23 | 24 | indexes of the text being matched, which could be used to provide |
24 | 25 | different completion depending upon which position the argument is in. |
25 | 26 |
|
26 | | -The `default' method may be overridden to intercept commands for which there |
| 27 | +The 'default' method may be overridden to intercept commands for which there |
27 | 28 | is no do_ method. |
28 | 29 |
|
29 | | -The `completedefault' method may be overridden to intercept completions for |
| 30 | +The 'completedefault' method may be overridden to intercept completions for |
30 | 31 | commands that have no complete_ method. |
31 | 32 |
|
32 | | -The data member `self.ruler' sets the character used to draw separator lines |
| 33 | +The data member 'self.ruler' sets the character used to draw separator lines |
33 | 34 | in the help messages. If empty, no ruler line is drawn. It defaults to "=". |
34 | 35 |
|
35 | | -If the value of `self.intro' is nonempty when the cmdloop method is called, |
| 36 | +If the value of 'self.intro' is nonempty when the cmdloop method is called, |
36 | 37 | it is printed out on interpreter startup. This value may be overridden |
37 | 38 | via an optional argument to the cmdloop() method. |
38 | 39 |
|
39 | | -The data members `self.doc_header', `self.misc_header', and |
40 | | -`self.undoc_header' set the headers used for the help function's |
| 40 | +The data members 'self.doc_header', 'self.misc_header', and |
| 41 | +'self.undoc_header' set the headers used for the help function's |
41 | 42 | listings of documented functions, miscellaneous topics, and undocumented |
42 | 43 | functions respectively. |
43 | 44 |
|
|
48 | 49 | One of the notable deviations is that since MicroPython strips doc strings, |
49 | 50 | this means that that help by doc string feature doesn't work. |
50 | 51 |
|
51 | | -completions have also been stripped out. |
| 52 | +Completions have also been stripped out. |
52 | 53 | """ |
53 | 54 |
|
54 | 55 | import sys |
|
0 commit comments