xonsh.ptk_shell.history

History object for use with prompt_toolkit.

class xonsh.ptk_shell.history.PromptToolkitHistory(load_prev=True, *args, **kwargs)[source]

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.)

async 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.

load_history_strings()[source]

Loads synchronous history strings

store_string(entry)[source]

Store the string in persistent storage.