Co-Authored-By: Claude <noreply@anthropic.com>
- commit
- f8b00baea04e0fd6015c4480c7f03fa87adc02ff
- parent
- c7a33bd5e0b1c14cc28681f698056508430fe77c
- author
- Dami <dami.etoile@gmail.com>
- kind
- docs risk score 0.3 of 3, Jev's estimate
| M | demos/ | 39 | ++++++++++++++++++------------ |
| M | demos/ | 12 | ++------- |
| A | docs/ | bin | |
| M | docs/ | bin | |
| M | docs/ | bin | |
| M | docs/ | 7 | +++-- |
| M | docs/ | 4 | ++- |
@@ -1,6 +1,7 @@
11 # Notebooks: 012 nu opens a notebook, its first cell ready to type in.22 # 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 notebook3+# output, entered with Enter, is a grid to select in, and goes to a4+# sheet (G) where a formula sums it; with the notebook45 # reactive, editing sales runs both again and the sheet follows. The terminal (ttyd) sends Shift+Enter as Enter, so56 # cells run with Esc then r. Needs nu on the PATH.67 Output out/notebook.gif@@ -12,52 +13,60 @@ Sleep 2s
1213 Show1314 1415 Sleep 800ms15-Type@25ms "sales = open data/sales.csv | where Region in [North South] | select Region Quarter Units"16+Type@15ms "sales = open data/sales.csv | where Region in [North South] | select Region Quarter Units"1617 Sleep 500ms1718 Escape1819 Type "r"19-Sleep 1.5s20+Sleep 1s2021 Type "b"2122 Enter22-Type@25ms "top = $sales | where Units > 250 | sort-by Units --reverse"23+Type@15ms "top = $sales | where Units > 250 | sort-by Units --reverse"2324 Sleep 500ms2425 Escape2526 Type "r"2627 Sleep 2s2728 Screenshot out/stills/notebook-cells.png29+Down30+Enter31+Sleep 400ms32+Ctrl+Shift+Down33+Sleep 1s34+Screenshot out/stills/notebook-grid.png35+Escape Escape36+Sleep 500ms2837 Type "G"2938 Sleep 800ms3039 Enter3140 Sleep 1.2s3241 Ctrl+K33-Type@40ms "next sh"42+Type@20ms "next sh"3443 Sleep 500ms3544 Enter36-Sleep 600ms45+Sleep 400ms3746 Right Right Right Right3847 Type "=SUM(nu.top)" Enter39-Sleep 1.5s48+Sleep 1s4049 Screenshot out/stills/notebook-sent.png4150 Ctrl+K42-Type@40ms "previous sh"51+Type@20ms "previous sh"4352 Sleep 500ms4453 Enter45-Sleep 600ms54+Sleep 400ms4655 Ctrl+K47-Type@50ms "reacti"48-Sleep 600ms56+Type@20ms "reacti"57+Sleep 400ms4958 Enter5059 Sleep 400ms51-Up Up60+Up Up Up5261 Sleep 300ms5362 Enter54-Type@30ms " | where Quarter != Q1"63+Type@20ms " | where Quarter != Q1"5564 Escape5665 Type "r"57-Sleep 2.5s66+Sleep 2s5867 Screenshot out/stills/notebook-reactive.png5968 Ctrl+K60-Type@40ms "next sh"69+Type@20ms "next sh"6170 Sleep 500ms6271 Enter6372 Sleep 2s@@ -1,6 +1,6 @@
11 # 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 the2+# second cell totals it by region, and Insert > Chart on its output's3+# grid sends the output to a sheet and charts the totals there. Cells run with Esc then r, as the44 # terminal (ttyd) sends Shift+Enter as Enter. Needs nu on the PATH.55 Output out/nu-recipe.gif66 Source lib/setup.tape@@ -24,13 +24,7 @@ Escape
2424 Type "r"2525 Sleep 2s2626 Screenshot out/stills/nu-recipe-cells.png27-Type "G"28-Sleep 800ms29-Enter30-Sleep 1s31-Ctrl+K32-Type@100ms "next sheet"33-Sleep 500ms27+Down3428 Enter3529 Sleep 800ms3630 Ctrl+KBinary file.
Binary file.
Binary file.
@@ -20,15 +20,16 @@ Money written as text (`"$2,252.50"`) becomes numbers in nushell, and a
2020 second cell totals it by region, sent to a sheet with a chart that2121 follows it.2222 23-23+2424 2525 ```nu2626 sales = open sales.csv | update Revenue { str replace -ar '[$,]' '' | into float }2727 totals = $sales | group-by Region --to-table | update items { get Revenue | math sum } | rename Region Revenue2828 ```2929 30-To chart it, `G` on `totals` sends its output to a new sheet; there,31-**Insert > Chart** charts the table around the pointer. Edit `sales` to30+To chart it, Enter on `totals`'s output, then **Insert > Chart**: the31+output goes to a new sheet named `totals` and the chart goes beside it32+([Outputs as grids](notebooks.md#outputs-as-grids)). Edit `sales` to3233 read another file and run it: `totals` shows `stale` until it runs too3334 (at once in a [reactive notebook](notebooks.md#stale-outputs-and-reactive-notebooks)),3435 and then the sheet and the chart follow.@@ -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`@@ -132,6 +132,8 @@ indicator says `OUTPUT`, and the bar left of it turns green, as for a
132132 cell edited): an active cell moves with the arrows, and the grid's keys,133133 menus and mouse work on it as on a sheet, in its window:134134 135+136+135137 - Shift+arrows, Ctrl+A or a drag select a range, and the status line136138 shows its Sum, Avg and Count; Ctrl+C copies it, as TSV to the system137139 clipboard and with its formats for Ctrl+V on a sheet.