Prompt Toolkit 2+ History Object (
History object for use with prompt_toolkit.
- class xonsh.ptk_shell.history.PromptToolkitHistory(load_prev=True, *args, **kwargs)¶
History class that implements the prompt-toolkit history interface with the xonsh backend.
Initialize history object.
- append_string(string: str) None ¶
Add string to the history.
- get_strings() List[str] ¶
Get the strings from the history that are loaded so far. (In order. Oldest item first.)
- load() AsyncGenerator[str, None] ¶
Load the history and yield all the entries in reverse order (latest, most recent history entry first).
This method can be called multiple times from the Buffer to repopulate the history when prompting for a new input. So we are responsible here for both caching, and making sure that strings that were were appended to the history will be incorporated next time this method is called.
Loads synchronous history strings
Store the string in persistent storage.