Import std.term.console
std.term.console
The console: whether stdin, stdout, and stderr are terminals, the terminal's size, and a key or a password read from it, over the runtime's fb_term_ functions, which put the console back as the program ends, however it ends. Reading keys goes through Terminal.Console(), whose state is the main thread's.
std/term/console.fb
Types
StandardStream
enum
Public Enum StandardStream
The console's streams.
-
What the program reads, stdin.
-
What it writes, stdout.
-
Its errors, stderr.
Functions
IsTerminal
function
Public Function IsTerminal(stream: StandardStream = StandardStream.OUTPUT): Bool
Whether stream is a terminal, which someone types at or reads, rather than a pipe or a file.
TerminalSize
function
Public Function TerminalSize(): (Int, Int)?
The terminal's size, in columns and rows: stdout's, or else stderr's or stdin's, or Null when none of them is a terminal.
ReadKey
function
Public Function ReadKey(): KeyEvent?
The next key typed at the console, as it's typed, without showing it, or Null once the input has ended. Ctrl+C still ends the program. From a pipe or a file, each character is a key, and a line break is ENTER.
ReadKey
function
Public Function ReadKey(timeout: Duration): KeyEvent?
ReadKey's twin that waits for timeout at most, and gives Null when no key came by then.
ReadPassword
function
Public Function ReadPassword(prompt: String = ""): String?
Writes the prompt, then reads a line typed at the console without showing it, as for a
password, up to ENTER. BACKSPACE takes back the last character, and Ctrl+U the whole line. Null
once the input has ended, or for Ctrl+D on an empty line, as Input gives at the end.
Report an issue with this page or with FutureBlitz on GitHub.