sily.terminal

Utils to work with POSIX terminal

Members

Aliases

ExitCode
alias ExitCode = ErrorCode

Alias to ErrorCode enum

Enums

ErrorCode
enum ErrorCode

Enum containing common exit codes

Functions

exit
void exit(ErrorCode code)

Forcefully closes application

getch
int getch()

Returns last pressed key

isTerminalRaw
bool isTerminalRaw()

Is terminal in raw mode (have setTerminalModeRaw been called yet?)

isatty
bool isatty(File file)
bool isatty(FILE* handle)
bool isatty(int fd_set)

Returns true if file is a tty

kbhit
int kbhit()

Returns 1 if any key was pressed

sleep
void sleep(uint msecs)

Sleeps for set amount of msecs

terminalHeight
int terminalHeight()

Returns bash terminal height

terminalModeSetRaw
void terminalModeSetRaw(bool removeStdoutBuffer)

Creates new termios and unbuffers stdout. Required for kbhit and getch DO NOT USE IF YOU DON'T KNOW WHAT YOU'RE DOING

terminalWidth
int terminalWidth()

Returns bash terminal width

Meta