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 tree for viewers

Add a tree for nested records or a directory walk.

Command Type

built-in

Signature

> tui tree {flags} (source)

Flags

  • --walk: Expand directories on disk when a node is opened.
  • --column {string}: Path/name column (default name).
  • --id {string}: Widget id.
  • --focus: Start with this widget focused.
  • --data {any}: Data for this widget alone, instead of the outer pipeline's.
  • --from {string}: Id of the table, tree, or select whose highlighted row drives this widget.
  • --on-select {closure(any)}: Hook run when the highlighted row changes; receives the state record.
  • --multi, -m: Space toggles rows; the selection is the checked rows.

Parameters

  • source: Closure over the --from row whose output is this tree's data.

Input/output types:

inputoutput
nothingtui
tuitui
anytui

Examples

Nested record as a tree

> {a: {b: 1, c: 2}, d: [3, 4]} | tui tree | tui debug | get screen

Directory walk next to a preview

> ls | tui split [(tui tree --walk) (tui preview)] | tui run

Notes

Up/Down move. Right or l expands, Left or h collapses. Enter submits the selected node; with --multi, Space checks nodes. --walk treats type == dir rows as folders and lists them on expand; --column names the path column for that walk. A tui preview or a --from widget next to this tree follows the selected node.