Prompt Toolkit 2 History Object (xonsh.ptk2.history)

History object for use with prompt_toolkit.

class xonsh.ptk2.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)

Add string to the history.

get_item_loaded_event()

Event which is triggered when a new item is loaded.

get_strings()

Get the strings from the history that are loaded so far.

load_history_strings()[source]

Loads synchronous history strings

load_history_strings_async()

Asynchronous generator for history strings. (Probably, you won’t have to override this.)

This should return an iterable that can yield both str and Future objects. The str objects have to be wrapped in a AsyncGeneratorItem object.

If we drop Python 2 support in the future, this could become a true asynchronous generator.

start_loading()

Start loading the history.

store_string(entry)[source]

Store the string in persistent storage.