termReadKey (Function)

Signature: termReadKey() -> Result<string, Error>

Description: Reads a single keypress from the terminal and returns it as a string.

Returns: Result<string, Error>

Example

// Run in an interactive terminal; raw mode is restored before printing.
termRawMode(1)
let key = termReadKey()
termRawMode(0)
print(key)
// Run in an interactive terminal; raw mode is restored before printing.
termRawMode 1
key = termReadKey ()
termRawMode 0
print key