The notebook, recipe and followed-log tapes run cells with Esc then r, as ttyd sends Shift+Enter and Ctrl+Enter as Enter. Mermaid diagrams show a cell's run states, the order cells run in, opening a notebook from elsewhere, what quitting sends, and the three ways to combine 012 and nushell.
- commit
- e1a9129696d95a16fe40673b6a98e7aa7555a32e
- parent
- 41fea2f93a7252a37478e2e8b68056be7693c40d
- author
- Dami <dami.etoile@gmail.com>
- kind
- docs risk score 0.8 of 3, Jev's estimate
| M | README.md | 2 | +- |
| M | ROADMAP.md | 2 | +- |
| M | cmd/ | 2 | +- |
| M | demos/ | 15 | ++++--- |
| M | demos/ | 62 | ++++++++++++++++++++++------- |
| M | demos/ | 29 | +++++++++----- |
| M | docs/ | 2 | +- |
| M | docs/ | bin | |
| M | docs/ | bin | |
| M | docs/ | bin | |
| M | docs/ | 10 | +++++ |
| M | docs/ | 65 | +++++++++++++++++++++++++----- |
| M | docs/ | 17 | ++++++++ |
| M | docs/ | 3 | +- |
| M | internal/ | 1 | + |
| M | website/ | 2 | +- |
@@ -67,7 +67,7 @@ rest: building from a clone, importing files, `012 serve` and settings.
6767 | Menus and the command palette (Ctrl+K) | Charts that float over the grid and follow their data |6868 |  |  |6969 | Conditional formatting and data validation | Pivot tables, live |70-|  |  |70+|  |  |7171 | Arrays that spill | Nushell notebooks |7272 |  |  |7373 | JEV functions in formulas | Macros |@@ -44,7 +44,7 @@ log macros record. Each step is useful on its own.
4444 4545 | Step | Result | Size |4646 |---|---|---|47-| A nushell region follows a streaming pipeline through the linked regions' live sources (`live.Source`), rows arriving as the pipeline writes them | Pipelines as live sheets | S |47+| A notebook cell's output follows a streaming pipeline through the linked regions' live sources (`live.Source`), rows arriving on its sheet as the pipeline writes them | Pipelines as live sheets | S |4848 | Shared viewing over SSH: several `012 serve` sessions open the same workbook; one edits, the others follow live with their own cursor, scroll and theme; presence shows who is where | Watch-along and review, one writer | M |4949 | Shared editing over SSH: every session edits, the server orders operations (no CRDT needed while one server holds the workbook), per-user undo, presence and edit ownership shown in the grid, saves by the server | Multiplayer 012 over SSH | L |5050 @@ -67,7 +67,7 @@ func usage() error {
6767 " sheet, or a .csv, .tsv, .json, .nuon, .xlsx, .sqlite, .parquet or .wk1 file to import\n" +6868 " 012 [flags] -: a table from standard input (NUON, JSON, CSV or TSV)\n" +6969 " 012 [flags] --pipe [--to nuon|json|csv|tsv] [--send ask|selection|sheet] [file]: on quitting, send the table to standard output\n" +70- " 012 nu [flags] [file]: a nushell notebook, at its prompt (see docs/nushell/notebooks.md)\n" +70+ " 012 nu [flags] [file]: the workbook's nushell notebook (see docs/nushell/notebooks.md)\n" +7171 " 012 nu --module | --install-module [--force] [path]: the nushell module with sheet (see docs/nushell/README.md)\n" +7272 " 012 serve [flags] [dir]: serve sheets in dir over SSH (see docs/terminal/ssh.md)\n" +7373 " 012 config [path|edit|default|themes|set-key|delete-key]\n" +@@ -1,8 +1,8 @@
11 # Following a log: a JSON lines log grows while 012 follows it in a22 # linked region (Data > Linked file > Link a table, here from the3-# palette). The shell prompt (Data > Shell, from the palette too) makes4-# a region that reads it as $app and keeps the errors;5-# refreshing it later reads the rows the log has now. The log is3+# palette). A notebook cell (Data > Notebook > Open notebook, from the4+# palette too) reads it as $app and keeps the errors; running the cell5+# again later (r) reads the rows the log has now. The log is66 # data/requests.jsonl written a line at a time. Needs nu on the PATH.77 Output out/follow-log.gif88 Source lib/setup.tape@@ -27,18 +27,19 @@ Enter
2727 Sleep 3.5s2828 Screenshot out/stills/follow-log-linked.png2929 Ctrl+K30-Type@100ms "shell"30+Type@100ms "open notebook"3131 Sleep 600ms3232 Enter3333 Sleep 600ms34+Type "!"3435 Type "errors = $app | where status >= 500 | select time path status ms"3536 Sleep 500ms36-Enter37+Escape38+Type "r"3739 Sleep 2.5s3840 Screenshot out/stills/follow-log-errors.png39-Escape4041 Sleep 6s41-Enter42+Type "r"4243 Sleep 2.5s4344 Screenshot out/stills/follow-log-refreshed.png4445 Sleep 1s@@ -1,7 +1,8 @@
1-# Notebooks: 012 nu opens a notebook at the nu❯ prompt. Each pipeline's2-# table becomes a named region; a second reads the first as $sales, and3-# giving sales a new command runs it again and then the region reading4-# it. Needs nu on the PATH.1+# Notebooks: 012 nu opens a notebook, its first cell ready to type in.2+# A code cell reads a CSV as sales, a second reads it as $sales, and its3+# output goes to a sheet (G) where a formula sums it; with the notebook4+# reactive, editing sales runs both again and the sheet follows. The terminal (ttyd) sends Shift+Enter as Enter, so5+# cells run with Esc then r. Needs nu on the PATH.56 Output out/notebook.gif67 Source lib/setup.tape78 @@ -11,22 +12,53 @@ Sleep 2s
1112 Show1213 1314 Sleep 800ms14-Type "sales = open data/sales.csv | where Region in [North South] | select Region Quarter Units"15+Type@25ms "sales = open data/sales.csv | where Region in [North South] | select Region Quarter Units"1516 Sleep 500ms16-Enter17+Escape18+Type "r"1719 Sleep 1.5s18-Type "$sales | where Units > 250 | sort-by Units --reverse"19-Sleep 500ms20+Type "b"2021 Enter22+Type@25ms "top = $sales | where Units > 250 | sort-by Units --reverse"23+Sleep 500ms24+Escape25+Type "r"2126 Sleep 2s22-Screenshot out/stills/notebook-regions.png23-Type "sales = open data/sales.csv | where Quarter == Q4 | select Region Quarter Units"27+Screenshot out/stills/notebook-cells.png28+Type "G"29+Sleep 800ms30+Enter31+Sleep 1.2s32+Ctrl+K33+Type@60ms "next sheet"2434 Sleep 500ms2535 Enter26-Sleep 2.5s36+Sleep 600ms37+Right Right Right Right38+Type "=SUM(nu.top)" Enter39+Sleep 1.5s40+Screenshot out/stills/notebook-sent.png41+Ctrl+K42+Type@60ms "previous sheet"43+Sleep 500ms44+Enter45+Sleep 600ms46+Ctrl+K47+Type@80ms "reactive"48+Sleep 600ms49+Enter50+Sleep 400ms51+Up Up52+Sleep 300ms53+Enter54+Type@30ms " | where Quarter != Q1"2755 Escape56+Type "r"57+Sleep 2.5s58+Screenshot out/stills/notebook-reactive.png59+Ctrl+K60+Type@60ms "next sheet"2861 Sleep 500ms29-Down Down Down30-Sleep 1.5s31-Screenshot out/stills/notebook-refreshed.png32-Sleep 1.5s62+Enter63+Sleep 2s64+Screenshot out/stills/notebook-sum.png@@ -1,6 +1,7 @@
1-# A notebook recipe: nushell cleans a CSV's money text into numbers,2-# a second region totals it by region, and a chart of the totals3-# follows the table. Needs nu on the PATH.1+# A notebook recipe: nushell cleans a CSV's money text into numbers, a2+# second cell totals it by region, and its output, sent to a sheet (G),3+# feeds a chart of the totals. Cells run with Esc then r, as the4+# terminal (ttyd) sends Shift+Enter as Enter. Needs nu on the PATH.45 Output out/nu-recipe.gif56 Source lib/setup.tape67 @@ -12,17 +13,25 @@ Show
1213 Sleep 800ms1314 Type@35ms `sales = open data/sales.csv | update Revenue { str replace -ar '[$,]' '' | into float }`1415 Sleep 500ms15-Enter16+Escape17+Type "r"1618 Sleep 2s19+Type "b"20+Enter1721 Type@35ms "totals = $sales | group-by Region --to-table | update items { get Revenue | math sum } | rename Region Revenue"1822 Sleep 500ms19-Enter20-Sleep 2s21-Screenshot out/stills/nu-recipe-regions.png2223 Escape23-Sleep 400ms24-Ctrl+G25-Type "A21:B25" Enter24+Type "r"25+Sleep 2s26+Screenshot out/stills/nu-recipe-cells.png27+Type "G"28+Sleep 800ms29+Enter30+Sleep 1s31+Ctrl+K32+Type@100ms "next sheet"33+Sleep 500ms34+Enter2635 Sleep 800ms2736 Ctrl+K2837 Type@120ms "chart"@@ -596,7 +596,7 @@ file followed as it grows: the importers' readers run on a goroutine of
596596 its own over a pipe that waits for the next piece, so a record cut off597597 at the end of one waits for the rest, and rows come out typed as an598598 import types them (`tail.go`). A `live.Source` is anything that yields a599-table's rows over time, which a nushell region following a pipeline599+table's rows over time, which a notebook cell following a pipeline600600 would be too.601601 602602 XLSX is read by 012's own SpreadsheetML reader on `archive/zip` andBinary file.
Binary file.
Binary file.
@@ -22,6 +22,16 @@ in a notebook, its cells' outputs live parts of the sheets.
2222 | [A notebook](notebooks.md) | `sheet nu`, then `files = ls \| select name size` in a code cell | Pipelines you keep, as in Jupyter: cells run when you ask, each output under its cell, read by later cells as `$files` and, sent to a sheet, by formulas and charts |2323 | [A followed file](../files/following.md) | Data > Linked file, then `$app \| where status >= 500` | A log or export that keeps growing: its rows come in as they're written, and pipelines read the rows it has now |2424 25+```mermaid26+flowchart TD27+ pipe["a nushell pipeline: ls | sheet"] --> stage["012 as a stage: edit the table"]28+ stage -->|what you send back| next["the next command"]29+ nb["a notebook: sheet nu"] -->|code cells run nu| out["outputs under their cells"]30+ out -->|G| region["a live region on a sheet: nu.name"]31+ file["a file that grows"] -->|Data > Linked file| linked["a linked region: nu.app"]32+ linked -->|$app| nb33+```34+2535 The first needs nothing but nushell. The other two run `nu` from inside2636 012, so it has to be installed ([Installing2737 nushell](https://www.nushell.sh/book/installation.html)); without it a@@ -16,7 +16,7 @@ files = ls | where type == file
1616 $files | where size > 1kb | sort-by size --reverse1717 ```1818 19-19+2020 2121 Open one from a shell with `012 nu`, or from nushell with `sheet nu`2222 (`sheet` comes from 012's nushell module: [Install the `sheet`@@ -49,10 +49,29 @@ A cell is its head, its source and, for a code cell, its output:
4949 5050 The head says how many runs came before this one (`[2]`, `[*]` while it5151 runs, `[ ]` before it has), the cell's name, and at the right how its run52-stands: `running`, `waiting` for the cell before it, `✓` or `failed` with53-how long it took, `stale`, `not run`, or `saved` for an output read from54-the file. A source is shown whole: a line too long for the screen wraps55-before a pipe where it can, its next rows indented.52+stands, `saved` for an output read from the file:53+54+```mermaid55+stateDiagram-v256+ notrun: not run57+ waiting: waiting58+ running: running59+ done: ✓ and how long it took60+ failed: failed, and nu's message under it61+ stale: stale62+ [*] --> notrun63+ notrun --> waiting: Shift+Enter, Ctrl+Enter, F964+ waiting --> running: the cell before it ends65+ running --> done66+ running --> failed: an error, or ii67+ done --> stale: a cell it reads runs again, or its source changes68+ stale --> waiting: run again69+ failed --> waiting: run again70+ done --> waiting: run again71+```72+73+A source is shown whole: a line too long for the screen wraps before a74+pipe where it can, its next rows indented.5675 5776 Outputs are drawn by what they are, with values formatted as cells5877 ([Types](types.md)):@@ -83,7 +102,6 @@ type into the selected cell.
83102 84103 ```mermaid85104 stateDiagram-v286- direction LR87105 [*] --> Command88106 Command --> Edit: Enter, !89107 Edit --> Command: Esc@@ -98,7 +116,7 @@ stateDiagram-v2
98116 | Home, End, PgUp, PgDn | The first cell, the last, a screen up or down |99117 | Enter | Edit the cell; on an output, open it full-screen |100118 | Shift+Enter | Run the cell and select the next, adding one at the end |101-| Ctrl+Enter | Run the cell, staying on it |119+| Ctrl+Enter, `r` | Run the cell, staying on it |102120 | Alt+Enter | Run the cell and add a code cell under it |103121 | F9 | Run every cell |104122 | `a`, `b` | Add a code cell above, below |@@ -122,6 +140,11 @@ stateDiagram-v2
122140 | Ctrl+A, Ctrl+E | The start, the end of the line |123141 | Tab | Complete the word at the caret: a cell's `$name`, `$selection`, a linked file, or one of nu's commands |124142 143+A terminal without the kitty keyboard protocol sends Shift+Enter and144+Ctrl+Enter as Enter ([Keys the terminal has to tell145+apart](../reference/keys.md#keys-the-terminal-has-to-tell-apart)): there146+Esc then `r` runs the cell, and Alt+Enter runs it and adds one under it.147+125148 Every action is a command, in **Data > Notebook**, the palette and the126149 shortcuts (Ctrl+/), and File, Edit and the sheet tabs work as anywhere;127150 commands for a sheet's cells are off on a notebook's tab. Changes to@@ -159,6 +182,18 @@ A name is letters, digits and `_`, not starting with a digit or `__`;
159182 can't share a name: the second says so and doesn't run until it's160183 renamed.161184 185+What a cell reads decides the order cells run in: each after the cells186+it reads, and a cell that hasn't run first when one reading it runs. A187+cell reading itself, directly or through others, doesn't run.188+189+```mermaid190+flowchart TD191+ files["files = ls"] -->|$files| big["big = $files | where size > 1kb"]192+ app["a linked file, app.csv"] -->|$app| errors["errors = $app | where status >= 500"]193+ big -->|G sends it to a sheet| region["the region big, on a sheet"]194+ region --> sum["=SUM(nu.big)"]195+```196+162197 A cell reads the sheets two ways, each a table:163198 164199 | In a cell | Is |@@ -178,7 +213,7 @@ directly or through others, `stale`: they were made from what it printed
178213 before. So is a cell's own output once its source is changed.179214 180215 ```mermaid181-flowchart LR216+flowchart TD182217 run["files runs again"] --> stale["big, and cells reading big: stale"]183218 stale -->|reactive off| you["run them when you want"]184219 stale -->|reactive on| again["they run again, each after what it reads"]@@ -230,8 +265,18 @@ Opening a file never runs its cells. Like
230265 run as you, with your files, so a notebook saved on another computer231266 asks once before its cells run:232267 233-```234-Run this file's notebook cells? Enter Run Esc Cancel268+```mermaid269+sequenceDiagram270+ participant You271+ participant N as The notebook272+ participant Nu as nu273+ You->>N: open a file saved on another computer274+ N-->>You: its cells and saved outputs, nothing run275+ You->>N: Shift+Enter, or F9276+ N-->>You: Run this file's notebook cells?277+ You->>N: Enter278+ N->>Nu: the cells, one at a time279+ Nu-->>N: their outputs235280 ```236281 237282 Cells you write in a notebook made here run without asking. The options,@@ -93,6 +93,23 @@ wants the same thing back:
9393 open orders.csv | to nuon | ^012 --pipe --send sheet | from nuon | save -f orders.nuon9494 ```9595 96+What quitting sends, and the [exit status](#the-exit-status) the97+pipeline sees:98+99+```mermaid100+flowchart TD101+ quit["Quit: Ctrl+Q, File > Quit, :q"] --> send{"--send"}102+ send -->|ask| question["the question"]103+ send -->|selection| sel["the selection, or the sheet while only the active cell is selected"]104+ send -->|sheet| sheet["the sheet"]105+ question -->|Enter| sel106+ question -->|S| sheet107+ question -->|D| none["nothing, exit status 1"]108+ question -->|Esc| back["back to the sheet"]109+ sel --> out["the table on standard output, exit status 0"]110+ sheet --> out111+```112+96113 The status line still names what Ctrl+Q will send, and File > Quit97114 without sending stays in the menu. The active cell on its own isn't a98115 selection to send, as at the question: `--send selection` sends the@@ -137,7 +137,7 @@ on a sheet, `!` starts an entry as any character does.
137137 |---|---|138138 | Up, Down, `j`, `k`, Home, End, PgUp, PgDn | Move between cells and their outputs |139139 | Enter | Edit the cell; on an output, open it full-screen |140-| Shift+Enter, Ctrl+Enter, Alt+Enter | Run the cell and select the next; run it in place; run it and add a cell under it |140+| Shift+Enter, Ctrl+Enter, `r`, Alt+Enter | Run the cell and select the next; run it in place (`r` too); run it and add a cell under it |141141 | F9 | Run every cell |142142 | `a`, `b`, `!` | Add a code cell above, below; add one below and edit it |143143 | `dd`, `z` | Delete the cell; undo |@@ -172,6 +172,7 @@ tells them apart and says when a key is let go, and there 012 also does:
172172 |---|---|---|173173 | Shift+Enter | Accept an entry and move up, as in Sheets | As Enter: accept and move down |174174 | Ctrl+I | Italic | As Tab: move right |175+| Shift+Enter, Ctrl+Enter | In a notebook, run the cell (and select the next) | As Enter: edit the cell, or a new line in it; Esc then `r` runs it, and Alt+Enter runs it and adds a cell under it |175176 | Space, held | On a selected chart, show it across the grid until Space is let go; in File > Settings > Theme with nothing typed, hide the list to see the whole sheet in the highlighted theme | Space does what it does there: deselects the chart and starts an entry, or types a space |176177 177178 ## Vim keys@@ -63,7 +63,7 @@ const cells: Cell[] = [
6363 entry: "'ls | sheet | where size > 1kb",6464 hint: 'Nushell: pipelines, notebooks, types, a cookbook',6565 title: 'Nushell, both ways',66- body: "A stage in a nushell pipeline with file sizes, durations and dates kept, or a notebook where each pipeline's table is a live, named region that formulas and charts read.",66+ body: "A stage in a nushell pipeline with file sizes, durations and dates kept, or a notebook of nushell cells whose outputs, sent to a sheet, are live tables that formulas and charts read.",6767 to: '/docs/nushell/',6868 },6969 {