mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
updated docs/api/history/
This commit is contained in:
parent
23ec9ab316
commit
a3027d020b
10 changed files with 48 additions and 13 deletions
|
@ -1,10 +0,0 @@
|
||||||
.. _xonsh_history:
|
|
||||||
|
|
||||||
******************************************************
|
|
||||||
History (``xonsh.history``)
|
|
||||||
******************************************************
|
|
||||||
|
|
||||||
.. automodule:: xonsh.history
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:inherited-members:
|
|
10
docs/api/history/base.rst
Normal file
10
docs/api/history/base.rst
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.. _xonsh_history_base:
|
||||||
|
|
||||||
|
===============================================
|
||||||
|
History Base Class -- :mod:`xonsh.history.base`
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
.. currentmodule:: xonsh.history.base
|
||||||
|
|
||||||
|
.. automodule:: xonsh.history.base
|
||||||
|
:members:
|
10
docs/api/history/json.rst
Normal file
10
docs/api/history/json.rst
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.. _xonsh_history_json:
|
||||||
|
|
||||||
|
=================================================
|
||||||
|
History Backend JSON -- :mod:`xonsh.history.json`
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
.. currentmodule:: xonsh.history.json
|
||||||
|
|
||||||
|
.. automodule:: xonsh.history.json
|
||||||
|
:members:
|
10
docs/api/history/main.rst
Normal file
10
docs/api/history/main.rst
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.. _xonsh_history_main:
|
||||||
|
|
||||||
|
======================================================
|
||||||
|
History Main Entry Points -- :mod:`xonsh.history.main`
|
||||||
|
======================================================
|
||||||
|
|
||||||
|
.. automodule:: xonsh.history.main
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:inherited-members:
|
10
docs/api/history/sqlite.rst
Normal file
10
docs/api/history/sqlite.rst
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.. _xonsh_history_sqlite:
|
||||||
|
|
||||||
|
=====================================================
|
||||||
|
History Backend Sqlite -- :mod:`xonsh.history.sqlite`
|
||||||
|
=====================================================
|
||||||
|
|
||||||
|
.. currentmodule:: xonsh.history.sqlite
|
||||||
|
|
||||||
|
.. automodule:: xonsh.history.sqlite
|
||||||
|
:members:
|
|
@ -473,7 +473,8 @@ xonsh when xonsh get launched. In this case, sqlite history backend should
|
||||||
work better.
|
work better.
|
||||||
|
|
||||||
To use sqlite history backend, set ``$XONSH_HISTORY_BACKEND = 'sqlite'`` in
|
To use sqlite history backend, set ``$XONSH_HISTORY_BACKEND = 'sqlite'`` in
|
||||||
your ``~/.xonshrc`` file.
|
your ``~/.xonshrc`` file. To switch back to JSON version, remove this line,
|
||||||
|
or set it to `'json'`.
|
||||||
|
|
||||||
.. tip:: If you have `sqlite-web <https://pypi.python.org/pypi/sqlite-web>`_
|
.. tip:: If you have `sqlite-web <https://pypi.python.org/pypi/sqlite-web>`_
|
||||||
installed, you can read the history easily with command:
|
installed, you can read the history easily with command:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Implements the xonsh history object."""
|
"""Implements JSON version of xonsh history backend."""
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import builtins
|
import builtins
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Implements the xonsh history object."""
|
"""Main entry points of the xonsh history."""
|
||||||
import argparse
|
import argparse
|
||||||
import builtins
|
import builtins
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -23,6 +23,7 @@ HISTORY_BACKENDS = {
|
||||||
|
|
||||||
|
|
||||||
def construct_history(**kwargs):
|
def construct_history(**kwargs):
|
||||||
|
"""Construct the history backend object."""
|
||||||
env = builtins.__xonsh_env__
|
env = builtins.__xonsh_env__
|
||||||
backend = env.get('XONSH_HISTORY_BACKEND')
|
backend = env.get('XONSH_HISTORY_BACKEND')
|
||||||
if backend not in HISTORY_BACKENDS:
|
if backend not in HISTORY_BACKENDS:
|
||||||
|
|
|
@ -169,6 +169,8 @@ class SqliteHistoryGC(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
class SqliteHistory(History):
|
class SqliteHistory(History):
|
||||||
|
"""Xonsh history backend implemented with sqlite3."""
|
||||||
|
|
||||||
def __init__(self, gc=True, filename=None, **kwargs):
|
def __init__(self, gc=True, filename=None, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
if filename is None:
|
if filename is None:
|
||||||
|
|
|
@ -1698,5 +1698,6 @@ def ensure_timestamp(t, datetime_format=None):
|
||||||
|
|
||||||
|
|
||||||
def format_datetime(dt):
|
def format_datetime(dt):
|
||||||
|
"""Format datetime object to string base on $XONSH_DATETIME_FORMAT Env."""
|
||||||
format_ = builtins.__xonsh_env__['XONSH_DATETIME_FORMAT']
|
format_ = builtins.__xonsh_env__['XONSH_DATETIME_FORMAT']
|
||||||
return dt.strftime(format_)
|
return dt.strftime(format_)
|
||||||
|
|
Loading…
Add table
Reference in a new issue