berhoel.cmd_line_history package

Save command line history and provide a command line completer for python.

berhoel.cmd_line_history.save_history(history_path=None)[source]
berhoel.cmd_line_history.hook()[source]

Submodules

berhoel.cmd_line_history.history module

Handle command line history.

class berhoel.cmd_line_history.history.History[source]

Bases: object

__init__()[source]
__repr__()[source]

print out current history information

__call__()[source]

print out current history information with line number

static save(filename, pos=None, end=None)[source]

write history number from pos to end into filename file

static clear()[source]

save the current history and clear it

static recall(history_path=PosixPath('/home/hoel/.pyhistory3'))[source]

clear the current history and recall it from saved

static execute(pos, end=None)[source]

execute history number from pos to end

berhoel.cmd_line_history.irl_completer module

Command line comleter helper for python.

class berhoel.cmd_line_history.irl_completer.IrlCompleter(*args, **kw)[source]

Bases: Completer, object

__init__(*args, **kw)[source]

Create a new completer for the command line.

Completer([namespace]) -> completer instance.

If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as dictionaries.

Completer instances should be used as the completion mechanism of readline via the set_completer() call:

readline.set_completer(Completer(my_namespace).complete)

complete(text, state)[source]

Return the next possible completion for ‘text’.

This is called successively with state == 0, 1, 2, … until it returns None. The completion should begin with ‘text’.

file_matches(text, mark)[source]
user_matches(text, mark)[source]