You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/history.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,9 @@ Each time a command is executed (this gets complex, see
14
14
[cmd2.Statement][] is appended to `cmd2.Cmd.history`.
15
15
16
16
`cmd2` adds the option of making this history persistent via optional arguments to
17
-
`cmd2.Cmd.__init__`. If you pass a filename in the `persistent_history_file` argument, the contents
18
-
of `cmd2.Cmd.history` will be written as compressed JSON to that history file. We chose this format
19
-
instead of plain text to preserve the complete `cmd2.Statement` object for each command.
17
+
[cmd2.Cmd.\_\_init\_\_][]. If you pass a filename in the `persistent_history_file` argument, the
18
+
contents of `cmd2.Cmd.history` will be written as compressed JSON to that history file. We chose
19
+
this format instead of plain text to preserve the complete `cmd2.Statement` object for each command.
20
20
21
21
!!! note
22
22
@@ -25,21 +25,22 @@ instead of plain text to preserve the complete `cmd2.Statement` object for each
25
25
However, this design choice causes an inconsistency between the `readline` history and the `cmd2` history when you enter an invalid command: it is saved to the `readline` history, but not to the `cmd2` history.
26
26
27
27
The `cmd2.Cmd.history` attribute, the `cmd2.history.History` class, and the
28
-
`cmd2.history.HistoryItem` class are all part of the public API for `cmd2.Cmd`. You could use these
29
-
classes to implement write your own `history` command (see below for documentation on how the
30
-
included`history` command works).
28
+
[cmd2.history.HistoryItem][] class are all part of the public API for `cmd2.Cmd`. You could use
29
+
these classes to implement your own `history` command (see below for documentation on how the
30
+
built-in`history` command works).
31
31
32
32
## For Users
33
33
34
-
You can use the up and down arrow keys to move through the history of previously entered commands.
34
+
You can use the :arrow_up: up and :arrow_down: down arrow keys to move through the history of
35
+
previously entered commands.
35
36
36
37
If the `readline` module is installed, you can press `Control-p` to move to the previously entered
37
38
command, and `Control-n` to move to the next command. You can also search through the command
38
39
history using `Control-r`.
39
40
40
-
Eric Johnson hosts a nice[readline cheat sheet](http://readline.kablamo.org/emacs.html), or you can
41
-
dig into the [GNU Readline User Manual](http://man7.org/linux/man-pages/man3/readline.3.html) for
42
-
all the details, including instructions for customizing the key bindings.
41
+
You can refer to the[readline cheat sheet](http://readline.kablamo.org/emacs.html) or you can dig
42
+
into the [GNU Readline User Manual](http://man7.org/linux/man-pages/man3/readline.3.html) for all
43
+
the details, including instructions for customizing the key bindings.
43
44
44
45
`cmd2` makes a third type of history access available with the `history` command. Each time the user
45
46
enters a command, `cmd2` saves the input. The `history` command lets you do interesting things with
Copy file name to clipboardExpand all lines: docs/features/initialization.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Here is a basic example `cmd2` application which demonstrates many capabilities
12
12
13
13
## Cmd class initializer
14
14
15
-
A `cmd2.Cmd` instance or subclass instance is an interactive CLI application framework. There is no good reason to instantiate `Cmd` itself; rather, it's useful as a superclass of a class you define yourself in order to inherit `Cmd`'s methods and encapsulate action methods.
15
+
A [cmd2.Cmd][] instance or subclass instance is an interactive CLI application framework. There is no good reason to instantiate `Cmd` itself; rather, it's useful as a superclass of a class you define yourself in order to inherit `Cmd`'s methods and encapsulate action methods.
16
16
17
17
Certain things must be initialized within the `__init__()` method of your class derived from `cmd2.Cmd`(all arguments to `__init__()` are optional):
0 commit comments