cli_t wrapper class.
More...
|
| __init__ (self) |
|
| __del__ (self) |
|
| register (self, flags=0, sname=None, lname=None, hint=None) |
| Registers the CLI.
|
|
| unregister (self) |
| Unregisters the CLI (if it was registered)
|
|
| OnExecuteLine (self, line) |
| The user pressed Enter.
|
|
| 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.
|
|
| OnCompleteLine (self, prefix, n, line, prefix_start) |
| The user pressed Tab.
|
|
This class allows you to implement your own command line interface handlers.
◆ __init__()
◆ __del__()
◆ OnCompleteLine()
OnCompleteLine |
( |
| self, |
|
|
| prefix, |
|
|
| n, |
|
|
| line, |
|
|
| prefix_start ) |
Find a completion number N for prefix PREFIX
This callback is optional.
- Parameters
-
prefix | Line prefix at prefix_start (string) |
n | completion number (int) |
line | the current line (string) |
prefix_start | the index where PREFIX starts in LINE (int) |
- Returns
- : None if no completion could be generated otherwise a String with the completion suggestion
◆ OnExecuteLine()
OnExecuteLine |
( |
| self, |
|
|
| line ) |
The CLI is free to execute the line immediately or ask for more lines.
This callback is mandatory.
- Parameters
-
- Returns
- : Boolean: True-executed line, False-ask for more lines
◆ OnKeydown()
OnKeydown |
( |
| self, |
|
|
| line, |
|
|
| x, |
|
|
| sellen, |
|
|
| vkey, |
|
|
| shift ) |
This callback is optional.
- Parameters
-
line | current input line |
x | current x coordinate of the cursor |
sellen | current selection length (usually 0) |
vkey | virtual key code. if the key has been handled, it should be returned as zero |
shift | shift state |
- Returns
- : 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)
◆ register()
register |
( |
| self, |
|
|
| flags = 0, |
|
|
| sname = None, |
|
|
| lname = None, |
|
|
| hint = None ) |
- Parameters
-
flags | Feature bits. No bits are defined yet, must be 0 |
sname | Short name (displayed on the button) |
lname | Long name (displayed in the menu) |
hint | Hint for the input line |
- Returns
- : Boolean: True-Success, False-Failed
◆ unregister()
◆ hint
◆ lname
◆ sname
The documentation for this class was generated from the following file: