Overview¶
Alternative Python bindings for GNU Readline.
Package Contents¶
rl exports the following components:
rl.completer
Interface to the readline completer. Used to configure the completion aspects of readline.
rl.completion
Interface to the active readline completion. Used to interact with readline when a completion is in progress.
rl.history
Interface to the readline history. Used to read and write history files and to manipulate history entries.
rl.readline
The readline bindings module. Contains everything known from the standard library plus extensions specific to the rl package. The
completer
,completion
, andhistory
interfaces make use of this module, and you should rarely need to interact with it directly.rl.generator()
A decorator turning any callable into a completion entry function that can be handed to readline.
rl.print_exc()
A decorator printing exceptions to stderr. Useful when writing Python completions and hooks, as exceptions occurring there are usually swallowed by the in-between C code.
Readline Completion¶
Completion is the process initiated when the user presses the TAB key. It has three phases: Word breaking, match generation, and match insertion/display.
For each phase, readline provides configuration settings and hooks that
allow applications to control the way the library behaves. See the
completer
and completion
objects for detailed descriptions of available properties.
Call Graph¶
A calling sequence for filename completion may look like this:
complete_internal()
find_completion_word()
gen_completion_matches()
insert_match()
display_matches()
Readline History¶
History allows readline to save and later recall lines the user has entered.
The history
object provides a list-like interface to the
history buffer as well as functions to persist the history between sessions.
Upstream Documentation¶
The GNU Readline Library and the GNU History Library.