History Backend Sqlite – xonsh.history.sqlite

Implements the xonsh history backend via sqlite3.

class xonsh.history.sqlite.SqliteHistory(gc=True, filename=None, **kwargs)[source]

Xonsh history backend implemented with sqlite3.

all_items(newest_first=False)[source]

Display all history items.

append(cmd)[source]

Append a command item into history.

Parameters:
cmd: dict

This dict contains information about the command that is to be added to the history list. It should contain the keys inp, rtn and ts. These key names mirror the same names defined as instance variables in the HistoryEntry class.

info()[source]

A collection of information about the shell history.

Returns:
dict or collections.OrderedDict

Contains history information as str key pairs.

items(newest_first=False)[source]

Display history items of current session.

run_gc(size=None, blocking=True)[source]

Run the garbage collector.

Parameters:
size: None or tuple of a int and a string

Determines the size and units of what would be allowed to remain.

blocking: bool

If set blocking, then wait until gc action finished.

class xonsh.history.sqlite.SqliteHistoryGC(wait_for_shell=True, size=None, filename=None, *args, **kwargs)[source]

Shell history garbage collection.

Thread responsible for garbage collecting old history.

May wait for shell (and for xonshrc to have been loaded) to start work.

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.