Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

tui debug for viewers

Render a TUI without a terminal and return the screen plus the resolved layout, focus order, and pages.

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:

inputoutput
tuirecord
anyrecord

Examples

Paint a title and status bar

> tui label --title "Demo" | tui label --status "ready" | tui debug | get screen

Replay keys and read the selection

> [{name: a}, {name: b}] | tui table | tui debug --keys [down enter] | get selected.name

See where each widget landed

> ls | tui split [(tui table) (tui preview)] | tui debug | get widgets.0.children | select id rect

Stop 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.index

Notes

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 string
  • widgets: the widget tree with each widget's layout rect, focusable, and per-kind fields: tables show resolved_columns and filtered rows; searches show their query; previews and --from widgets show the source they follow; lists show the search_scope that filters them
  • focus: the tab order and the default focus
  • pages: 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.