Module rl_sys::history::histfile [] [src]

2.3.6 Managing the History File

The History library can read the history from and write it to a file. This section documents the functions for managing a history file.

Functions

append

Append the last n elements of the history list to filename. If filename is None, then append to ~/.history. Returns 0 on success, or HistoryError with errno information on a write error.

read

Add the contents of filename at path to the history list, a line at a time. If the path is None, then read from ~/.history. Returns 0 if successful, or HistoryError with errno information if not.

read_range

Read a range of lines from filename, adding them to the history list. Start reading at line from and end at to. If from is zero, start at the beginning. If to is less than from, then read until the end of the file. If filename is None, then read from ~/.history. Returns 0 if successful, or HistoryError with errno information if not.

truncate

Truncate the history file filename, leaving only the last n lines. If filename is None, then ~/.history is truncated. Returns 0 on success, or HistoryError with errno information on a write error.

write

Write the current history to filename, overwriting filename if necessary. If filename is None, then write the history list to ~/.history. Returns 0 on success, or HistoryError with errno information on a read or write error.