tui debug for viewers
Command Type
built-in
Signature
> tui debug {flags} (hook)
Flags
--keys, -k {oneof<list<string>, string>}: Key tokens to replay before painting.--until, -u {closure(any)}: Stop replaying keys once this returns true for the state record.--size, -s {list<int>}: Canvas [width height]. Default [80 24].--dialog, -d: Paint as a floating popup.
Parameters
hook: Hook whose output replaces the data list, run once.
Input/output types:
| input | output |
|---|---|
| tui | record |
| any | record |
Examples
Paint a title and status bar
> tui label --title "Demo" | tui label --status "ready" | tui debug | get screenReplay keys and read the selection
> [{name: a}, {name: b}] | tui table | tui debug --keys [down enter] | get selected.nameSee where each widget landed
> ls | tui split [(tui table) (tui preview)] | tui debug | get widgets.0.children | select id rectStop replaying once a condition holds
> [a b c] | tui table | tui debug --keys [down down down] --until {|s| $s.values.table-0.index == 1 } | get values.table-0.indexNotes
Use this to test a TUI in a script or CI, or to see why it looks the way it does. The result record has the same fields as tui run (action, focused, selected, page, values, rows, live) plus:
screen: the painted buffer as a stringwidgets: the widget tree with each widget's layoutrect,focusable, and per-kind fields: tables showresolved_columnsand filteredrows; searches show theirquery; previews and--fromwidgets show thesourcethey follow; lists show thesearch_scopethat filters themfocus: the tab order and the default focuspages: the tab bar entries
--keys replays tokens before painting, as a comma-separated string or a list: enter, esc, tab, shift+tab, up, down, left, right, home, end, pageup, pagedown, backspace, delete, space, insert, ctrl+c, alt+a, f1, a single character, type:hello, click:COL,ROW, drag:COL,ROW, scroll-up, scroll-down. action is render when the keys finished without Enter or quit. --until {|state| ...} stops the replay early once the closure returns true.
A live stream is read for up to 5 seconds (and no more rows than the widgets keep) before painting. A hook closure runs once with the state record, as tui run would.