tui.data.new
tui.data.new NAME [--cols "A|B"] [--key COL] [--max N] [--scope page|session|disk]
Declares a dataset: a named list of rows that code appends to, changes and removes, and that widgets can show.
Parameters
NAME: letters, digits and_, not starting with a digit.--cols: column names separated by|. They name columns in the other calls and become a table’s header.--key COL: the column whose value identifies a row. A keyed dataset has at most one row per key, sotui.data.appendwith an existing key replaces that row.--max N: keep only the newestNrows; the oldest row goes when one is added pastN.--scope:page(dropped when the page is left),session(kept for the run, the default) ordisk(also written to$TUI_HOME/state/data/NAME, read here).
Returns: 1 for a bad name, option or key column. Declaring a dataset that exists changes nothing, so a page may declare it on every visit.
Example
tui.data.new latency --cols "ms" --max 60
tui.data.new hosts --cols "host|state" --key host
