Exemplo n.º 1
0
 def operation_sequence(history_file):
     history_obj = LimitedFileHistory()
     history_obj.read_history_file(history_file)
     history_obj.append('line0')
     history_obj.append('line1')
     history_obj.append('line2')
     history_obj.append('line3')
     history_obj.save_history_to_file(history_file)
Exemplo n.º 2
0
def setup_history():
    """Creates history object."""
    env = builtins.__xonsh_env__
    hfile = env.get('XONSH_HISTORY_FILE')
    history = LimitedFileHistory()
    try:
        history.read_history_file(hfile)
    except PermissionError:
        warn('do not have read permissions for ' + hfile, RuntimeWarning)
    return history
Exemplo n.º 3
0
def setup_history():
    """Creates history object."""
    env = builtins.__xonsh_env__
    hfile = env.get('XONSH_HISTORY_FILE')
    history = LimitedFileHistory()
    try:
        history.read_history_file(hfile)
    except PermissionError:
        warn('do not have read permissions for ' + hfile, RuntimeWarning)
    return history
Exemplo n.º 4
0
def setup_history():
    """Creates history object."""
    env = builtins.__xonsh_env__
    hfile = env.get("XONSH_HISTORY_FILE", os.path.expanduser("~/.xonsh_history"))
    history = LimitedFileHistory()
    try:
        history.read_history_file(hfile)
    except PermissionError:
        warn("do not have read permissions for " + hfile, RuntimeWarning)
    return history
Exemplo n.º 5
0
 def operation_sequence(history_file):
     history1 = LimitedFileHistory()
     history2 = LimitedFileHistory()
     history1.append('line4')
     history2.append('line5')
     history1.save_history_to_file(history_file)
     history2.save_history_to_file(history_file)
Exemplo n.º 6
0
 def operation_sequence(history_file):
     history_obj = LimitedFileHistory()
     history_obj.read_history_file(history_file)
     history_obj.save_history_to_file(history_file, limit=4)