diff --git a/xonsh/history/__init__.py b/xonsh/history/__init__.py index 65ce65af8..84acbdf3e 100644 --- a/xonsh/history/__init__.py +++ b/xonsh/history/__init__.py @@ -3,11 +3,13 @@ import builtins import time +from xonsh.history.dummy import History as DummyHistory from xonsh.history.json import History as JsonHistory from xonsh.history.json import history_main from xonsh.history.sqlite import History as SqliteHistory _BACKENDS = { + 'dummy': DummyHistory, 'json': JsonHistory, 'sqlite': SqliteHistory, } @@ -15,8 +17,7 @@ _BACKENDS = { def get_history_backend(env, ts, locked, gc=True, filename=None): env = builtins.__xonsh_env__ - backend = env.get('XONSH_HISTORY_BACKEND', 'sqlite') - print('backend str: {}'.format(backend)) + backend = env.get('XONSH_HISTORY_BACKEND', 'json') try: kls_history = _BACKENDS[backend] except KeyError: diff --git a/xonsh/history/dummy.py b/xonsh/history/dummy.py new file mode 100644 index 000000000..f02ae2b8c --- /dev/null +++ b/xonsh/history/dummy.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +"""Implements the xonsh history backend.""" +import threading + + +class HistoryGC(threading.Thread): + pass + + +class History: + def __init__(self, gc=True, **kwargs): + self.gc = HistoryGC() if gc else None + self.rtns = None + self.last_cmd_rtn = None + self.last_cmd_out = None + + def __iter__(self): + for cmd, ts, index in []: + yield (cmd, ts, index) + + def append(self, cmd): + print('DummyHistory append cmd: {}'.format(cmd)) + + def flush(self, at_exit=False): + print('DummyHistory flush() called') + + def get_history_items(self): + return [{'inp': 'dummy in action\n'}]