source/cli.tcl
Procedure Summary |
appendHistory { cmdline } Add a command to the history buffer. |
browseHistory { direction } Handle history action: go to the previous entry, next, first or |
clear { } Clears screen, leaving the cursor at the last row, first |
clearline { } Removes any character printed before the position of the cursor, and send the cursor at the beginning of the line (like |
cmdline_insert { str pos } Insert a string into the specified position in CMDLINE, and update CMDLINE_CURSOR to point at the end of the inserted |
event_not_found { } A helper procedure to display the "event not found" message and reset |
execute_cmd { cmdline } Execute the provided command. |
getinfo { name } Get formatted information about the system. |
goto { row {col 1} } Set the cursor to (row, col) coordinates. |
gotocol { col } Set the cursor to col; same row. |
handleAction { action } Command line editing action |
handleCompletion { } Implements TAB expansion and display of available options for command names and argument |
handleControls { } Handle control characters (single byte characters with special meaning) @assume char variable exists on uplevel |
handleEscapes { } Handle escape sequences: Sequences prepended by escape that have special meaning @assume keybuffer variable exists on uplevel |
handleHelp { } Displays in-line help for MikroConf commands & arguments. |
handleSpecial { char } Handle special sequences which start with Ctrl + ^ combination @assume keybuffer variable exists on uplevel |
makePrompt { } Render the prompt from the prompt specifications set in PROMPT Shared Global Variable. |
notEscaped { } We check if a '?' that is pressed is preceeded by '\', in which case it loses its special |
pos2index { lst pos } Returns the index in the list of the item that the string position $pos points to. |
prompt { type } This procedure prints the existing command text and command prompt. |
readbuf { txt } Return and remove the first character from a FILO string. |
ready { } The main procedure to listen and handle command line input. |
remove_spaces { cmdline cursor } Remove unecessary spaces between words on the command line. |
Procedure Detail |
proc appendHistory { cmdline }
cmdline
- the command line to be stored in the history buffer
proc browseHistory { direction }
direction
- action specification: one of "-back", "-forth", "-newest", "-oldest"
proc clear { }
proc clearline { }
proc cmdline_insert { str pos }
str
- The string to insert
pos
- The position to insert the string
proc event_not_found { }
proc execute_cmd { cmdline }
cmdline
- The command string to execute.
proc getinfo { name }
name
- A name that identifies the info to be requested
proc goto { row {col 1} }
row
- Send the cursor to absolute row $row; e.g from 0 to 24, for an 24 rows terminal.
col
- Send the cursor to absolute col $col, or beginning of line if not specified; e.g from 0 to 79, for an 80 columns terminal.
proc gotocol { col }
col
- The column to place the cursor at. e.g from 0 to 79, for an 80 columns terminal.
proc handleAction { action }
action
- the action to which we should respond
proc handleCompletion { }
proc handleControls { }
proc handleEscapes { }
proc handleHelp { }
proc handleSpecial { char }
The
- special character.
proc makePrompt { }
proc notEscaped { }
proc pos2index { lst pos }
lst
- A list
pos
- A number pointing in the list as a string. zero-based.
proc prompt { type }
type
- Type of prompt: "new" (prompt) or "redraw" (the existing).
proc readbuf { txt }
txt
- The buffer to read from, passed by name for performance reasons.
proc ready { }
proc remove_spaces { cmdline cursor }
cmdline
- Command line.
cursor
- Cursor position in the command line