cli_t wrapper class.
This class allows you to implement your own command line interface handlers.
OnFindCompletions |
( |
| self, |
|
|
| line, |
|
|
| x ) |
The user pressed Tab. Return a list of completions
This callback is optional.
@param line: the current line (string)
@param x: the index where the cursor is (int)
@return: None if no completion could be generated, otherwise a tuple:
(completions : Sequence[str], hints : Sequence[str], docs: Sequence[str],
match_start: int, match_end: int)
OnKeydown |
( |
| self, |
|
|
| line, |
|
|
| x, |
|
|
| sellen, |
|
|
| vkey, |
|
|
| shift ) |
A keyboard key has been pressed
This is a generic callback and the CLI is free to do whatever it wants.
This callback is optional.
@param line: current input line
@param x: current x coordinate of the cursor
@param sellen: current selection length (usually 0)
@param vkey: virtual key code. if the key has been handled, it should be returned as zero
@param shift: shift state
@return:
None - Nothing was changed
tuple(line, x, sellen, vkey): if either of the input line or the x coordinate or the selection length has been modified.
It is possible to return a tuple with None elements to preserve old values. Example: tuple(new_line, None, None, None) or tuple(new_line)