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-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@
4
4
5
5
The `cmd` module from the Python standard library includes `readline` history.
6
6
7
-
[cmd2.Cmd][] offers the same `readline`capabilities, but also maintains its own data structures for
8
-
the history of all commands entered by the user. When the class is initialized, it creates an
9
-
instance of the [cmd2.history.History][] class (which is a subclass of`list`) as
10
-
`cmd2.Cmd.history`.
7
+
[cmd2.Cmd][] offers the same `readline`capabilitie via use of `prompt-toolkit`, but also maintains
8
+
its own data structures for the history of all commands entered by the user. When the class is
9
+
initialized, it creates an instance of the [cmd2.history.History][] class (which is a subclass of
10
+
`list`) as `cmd2.Cmd.history`.
11
11
12
12
Each time a command is executed (this gets complex, see
13
13
[Command Processing Loop](./hooks.md#command-processing-loop) for exactly when) the parsed
@@ -20,9 +20,9 @@ this format instead of plain text to preserve the complete `cmd2.Statement` obje
20
20
21
21
!!! note
22
22
23
-
`readline` saves everything you type, whether it is a valid command or not. `cmd2` only saves input to internal history if the command parses successfully and is a valid command. This design choice was intentional, because the contents of history can be saved to a file as a script, or can be re-run. Not saving invalid input reduces unintentional errors when doing so.
23
+
`prompt-toolkit` saves everything you type, whether it is a valid command or not. `cmd2` only saves input to internal history if the command parses successfully and is a valid command. This design choice was intentional, because the contents of history can be saved to a file as a script, or can be re-run. Not saving invalid input reduces unintentional errors when doing so.
24
24
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.
25
+
However, this design choice causes an inconsistency between the `prompt-toolkit` history and the `cmd2` history when you enter an invalid command: it is saved to the `prompt-toolkit` history, but not to the `cmd2` history.
26
26
27
27
The `cmd2.Cmd.history` attribute, the `cmd2.history.History` class, and the
28
28
[cmd2.history.HistoryItem][] class are all part of the public API for `cmd2.Cmd`. You could use
0 commit comments