CLI, terminal & markup4 exports
Raw Markdown/tty
Terminal capability detection, dimensions, raw mode controls, and interactive prompt helpers.
Functions & symbols#
ask#
function
Writes an optional prompt to active `*out*`, flushes, and reads a single line from active `*in*`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
prompt | Any | required | Optional prompt displayed before reading a line |
Returns:
Any(let name (tty/ask "Name: "))color-enabled?#
function
Returns `true` if ANSI color output should be enabled for the target stream, honoring `NO_COLOR`, `FORCE_COLOR`, `TERM=dumb`, and TTY status.
| Parameter | Type | Optional | Description |
|---|---|---|---|
stream | Any | Symbol | required | Optional stream value or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |
Returns:
Any(tty/color-enabled?)(tty/color-enabled? :err-port)is-tty?#
function
Returns `true` if the target stream (defaults to active `*out*`) is attached to an interactive OS terminal (TTY).
| Parameter | Type | Optional | Description |
|---|---|---|---|
stream | Any | Symbol | required | Optional stream value (such as `out-port`, `*out*`, or `Buffer`) or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |
Returns:
Any(tty/is-tty?)(tty/is-tty? :err-port)size#
function
Returns `{:cols Int :rows Int}` when attached to a terminal, or `()` when not attached to a TTY.
Returns:
Any(let dims (tty/size))