Scripts (docs/files/scripts.md) covers get, set, recalc and export, references, and what --regions, --trust and --jev run. Diff and merge in git (docs/files/git.md) covers 012 diff, the .gitattributes and git config lines, and how merge-driver merges, with a Mermaid flow of its rule. Command line in the reference lists every command, flag and exit status. A cookbook recipe, the architecture's packages and the roadmap's Shipped list follow.
- commit
- 3a646347272b879a989447e3035eb91f69c28f42
- parent
- 0e68606b8d2a96a1052552eae7cabe60eeab4c6b
- author
- Dami <dami.etoile@gmail.com>
- kind
- docs risk score 0.1 of 3, Jev's estimate
| M | ROADMAP.md | 4 | +- |
| M | docs/ | 4 | +- |
| M | docs/ | 20 | ++++- |
| M | docs/ | 2 | + |
| A | docs/ | 148 | ++++++++++++++++++++++++++++++ |
| A | docs/ | 147 | ++++++++++++++++++++++++++++++ |
| M | docs/ | 9 | ++- |
| M | docs/ | 20 | ++++ |
| M | docs/ | 1 | + |
| A | docs/ | 63 | +++++++++++++ |
| M | internal/ | 4 | +- |
@@ -71,8 +71,6 @@ shared editing in section 3.
7171 7272 | Item | Result | Size |7373 |---|---|---|74-| Commands for scripts without the screen: `012 get`, `012 set`, `012 recalc`, `012 export` on a workbook file | 012 in scripts, cron and nushell pipelines | S to M |75-| `012 diff` cell by cell (values, formulas, formats, regions) and a git diff and merge driver for `.012` | Sheets kept in git review like code | M |7674 | Formula tracing: precedents and dependents shown in the grid, a formula evaluated step by step | Finding why a number is wrong | M |7775 | Named tables with structured references (`Sales[Amount]`); notebook regions are tables | Formulas that read by column name | M |7876 | A sheet or chart exported as a static HTML page in 012's look | Sharing a sheet with someone without 012 | S |@@ -148,6 +146,8 @@ stream above rather than a design of their own.
148146 149147 - Import CSV, TSV, JSON, NUON, XLSX, SQLite, Parquet and Lotus `.wk1`; export CSV, TSV, JSON, NUON, XLSX and SQLite; import locations; save-as and overwrite checks: [Files](docs/files/README.md)150148 - `.012` files read and written as a stream, cells straight into and out of the store: [The .012 format](docs/files/format.md#reading-and-writing)149+- Commands for scripts without the screen: `012 get` (text, CSV, TSV, JSON or NUON), `012 set`, `012 recalc` and `012 export`, running regions and JEV only behind flags: [Scripts](docs/files/scripts.md)150+- `012 diff` cell by cell, as git's diff command or textconv, and `012 merge-driver` merging cell by cell with conflicts noted on the cells: [Diff and merge in git](docs/files/git.md)151151 - Following files: a linked region follows a CSV, TSV, JSON lines or NUON file as it grows and any importable file as it's rewritten, keeping every row or the last ones, its rows arriving as the change stream: [Following files](docs/files/following.md)152152 153153 **Upkeep**@@ -10,10 +10,10 @@ sidebar_position: 1
1010 | [Getting started](getting-started/README.md) | Installing and running 012, and the screen |1111 | [Working with sheets](sheets/README.md) | Editing, formatting, sheets, sort and filter, find, rules, pivot tables, notes, charts, macros |1212 | [Formulas](formulas/README.md) | Entries, references, building formulas, arrays, decimal arithmetic, JEV functions |13-| [Files](files/README.md) | Import and download, Excel files, saving, the `.012` format |13+| [Files](files/README.md) | Import and download, Excel files, saving, the `.012` format, scripts, diff and merge in git |1414 | [The terminal](terminal/README.md) | Terminal features, themes, serving over SSH |1515 | [Nushell](nushell/README.md) | 012 in a pipeline, nushell notebooks, types, a cookbook |16-| [Reference](reference/README.md) | Keys, functions, configuration, the macro API |16+| [Reference](reference/README.md) | Keys, functions, configuration, the macro API, the command line |1717 | [Contributing](contributing/README.md) | Architecture, extending, the UX bar, testing, limits, observability |1818 1919 The [roadmap](../ROADMAP.md) says what's ahead. The docs are Markdown that@@ -9,7 +9,7 @@ sidebar_position: 2
99 Lip Gloss v2.1010 1111 ```12-cmd/012 entry point: flags and config, 012 config, 012 serve, JEV setup, opening or importing a file, 012 - and --pipe on the terminal12+cmd/012 entry point: flags and config, 012 config, 012 serve, JEV setup, opening or importing a file, 012 - and --pipe on the terminal, the commands without the screen1313 internal/config the config file and the registry of options1414 internal/sheet the engine: cells, recalculation, undo, files, names, pivots1515 internal/functions the function library: the FuncDef table, evaluation, decimal arithmetic, JEV questions@@ -20,6 +20,8 @@ internal/locale the locales: separators, date order, currency, formula separato
2020 internal/fileio import and export: CSV, TSV, XLSX, SQLite, Parquet, Lotus .wk1, JSON, NUON; tables on streams2121 internal/nuon nushell's object notation: typed values, tables read a row at a time, written back2222 internal/live the sources of linked regions: files followed as they grow or are rewritten23+internal/headless workbook files without the screen: references, get, set, recalc, regions and JEV when asked, atomic saves24+internal/diff workbooks compared and merged cell by cell, from their files' fields2325 internal/chart chart layout, text rendering and kitty image encoding2426 internal/jev the API key's resolution, answer cache and TypeSafe client2527 internal/keyring the OS credential store the API key lives in@@ -67,6 +69,7 @@ flowchart TD
6769 direction LR6870 ui[internal/ui] ~~~ fileio[internal/fileio] ~~~ live[internal/live] ~~~ nushell[internal/nushell]6971 chart[internal/chart] ~~~ jev[internal/jev] ~~~ stress[internal/stress] ~~~ oracle[oracle]72+ headless[internal/headless] ~~~ diff[internal/diff]7073 end7174 callers --> sheet[internal/sheet]7275 sheet --> functions[internal/functions]@@ -619,6 +622,21 @@ written a row at a time. One package suits formats that share this much
619622 translation); a format that grew its own dependencies would move to a620623 subpackage behind the same table row.621624 625+`internal/headless` is the engine without the screen, for `012 get`,626+`set`, `recalc` and `export` ([Scripts](../files/scripts.md)): it627+resolves references, writes values through the same snapshots and628+encoders as downloads, types entries through `Sheet.Set` in one629+`Batch`, and saves with a write-then-rename. It runs regions through630+`internal/nushell` and asks `internal/jev` only when its caller says631+so; `cmd/012` decides, by the flags and the macro-origin trust.632+633+`internal/diff` reads a `.012` file as its JSON fields: the workbook's,634+and each sheet's with its cells by address. Comparing and merging go635+field by field, so a field added to the format is compared and merged636+without teaching them about it, and the engine is used only to compute637+values (`Compare`) and to check and write the merged workbook638+(`Merge`), which it reads back as 012 would open it.639+622640 ## Macros623641 624642 Macros are Starlark scripts (`go.starlark.net`, pure Go) kept in the@@ -74,3 +74,5 @@ own 8,192 by 256. See [Bounds of support](../contributing/limits.md#imports) for
7474 | [Saving](saving.md) | Atomic saves, overwrite checks, unsaved work under `012 serve` |7575 | [Following files](following.md) | Linked regions that follow a file as it grows or is rewritten, like `tail -f` |7676 | [The .012 format](format.md) | The JSON format, its versions and fields |77+| [Scripts](scripts.md) | `012 get`, `set`, `recalc` and `export`: workbooks read and changed without the screen |78+| [Diff and merge in git](git.md) | `012 diff` cell by cell, and git's diff and merge drivers for `.012` files |@@ -0,0 +1,148 @@
1+---2+title: "Diff and merge in git"3+sidebar_position: 74+---5+6+# Diff and merge in git7+8+`012 diff` compares two workbooks cell by cell, and `012 merge-driver`9+merges them, so sheets kept in git are reviewed and merged like code.10+11+## 012 diff12+13+```sh14+012 diff budget.012 budget-v2.01215+```16+17+```18+sheet Q4 renamed from Q319+sheet Notes added20+Q4!B7 input =SUM(A1:A5) → =SUM(A1:A6)21+Q4!B7 value 15 → 2122+Q4!C2 value 15 → 2123+Q4!D9 input - 4224+Q4!A12 input + Total25+Q4!B3 format currency, decimals 2 → currency, bold, decimals 226+Q4!B3 note check → checked27+Q4 widths C 10 → 1428+Q4 region r2 command ls → ls -a29+name Sales range Q3!B2:B20 → Q4!B2:B2130+```31+32+A line says where, what about it changed, and `old → new`, `+ new` for33+something added or `- old` for something removed. On a terminal (and in34+git's pager) the old side is red and the new green; `--color never` or35+`NO_COLOR` turns that off, `--color always` on.36+37+What it compares:38+39+| Change | Lines |40+|---|---|41+| Sheets | `added`, `removed`, `renamed from`, `moved from 3 to 1`. A sheet under a new name that holds at least half the cells of one gone is that sheet renamed |42+| Cells | `input` (what was typed: a formula or an entry), `value` (what a formula computes, or an array spilled), `format` (the cell's formatting, by its fields in the file), `note` |43+| Regions | Each [notebook region](../nushell/notebooks.md) or [linked file](following.md) by name: added, removed, or which field changed |44+| Layout | Every other field of a sheet, by its name in [the file](format.md): `widths`, `heights` and `lines` key by key, the rest (`charts`, `conditionalFormats`, `freeze`) whole |45+| Workbook | Named ranges, macros, the locale and decimal arithmetic |46+47+A value is shown only for formulas and cells an array filled, since a48+typed entry's value is its input. Values that change on every49+recalculation (`NOW()`, `RAND()` and what reads them, on any sheet)50+aren't compared, and neither is anything that needs a region's command51+or JEV run: `012 diff` only reads the two files. The sheet shown, the52+file's version, the notebook prompt's history and which computer53+trusted its commands aren't changes either.54+55+`--format json` and `--format nuon` write the changes as a table with56+the columns `kind`, `sheet`, `item`, `field`, `old` and `new`, values57+with their types:58+59+```nu60+012 diff a.012 b.012 --format nuon | from nuon | where kind == cell and field == value61+```62+63+The exit status is diff(1)'s: 0 when the workbooks are the same, 1 when64+they differ, 2 on trouble (a file that can't be read).65+66+## Git67+68+Tell git which files are workbooks, in `.gitattributes` at the top of69+the repository (committed, so everyone's clone knows):70+71+```72+*.012 diff=012 merge=01273+```74+75+and what `012` means for them, in each clone or in your global git76+config (git doesn't take commands from a repository):77+78+```sh79+git config diff.012.command '012 diff'80+git config diff.012.textconv '012 diff --textconv'81+git config merge.012.name '012 cell by cell'82+git config merge.012.driver '012 merge-driver %O %A %B %P'83+```84+85+- **`diff.012.command`** makes `git diff`, `git show` and `git log -p`86+ show 012's diff for each workbook, under a `diff --012 a/budget.01287+ b/budget.012` header. Git calls it with its own seven arguments, which88+ `012 diff` recognizes; it exits 0 then, as git expects.89+- **`diff.012.textconv`** is for what doesn't use the external diff:90+ `git diff --no-ext-diff`, `git log -p --no-ext-diff`, `git blame`,91+ `git grep` and hosting sites that honor textconv. `012 diff --textconv92+ file` writes the workbook as one line per cell and field, each naming93+ its sheet (`Q3!B7 =SUM(A1:A6) = 21 [currency, decimals 2]`), and git94+ diffs those lines. Either can be set alone.95+- **`merge.012.driver`** merges workbooks cell by cell, below.96+97+## Merging98+99+`012 merge-driver base ours theirs [path]` merges theirs into ours from100+their common base and writes the result over ours, which is what git101+asks of a merge driver (`%O %A %B %P`). Each part of a workbook merges102+on its own:103+104+```mermaid105+flowchart TD106+ part["A part: a cell's input, format or note; a sheet's name; a column's width; a region; a named range"]107+ part --> same{"Did both sides change it?"}108+ same -- "One side, or neither" --> take["Take the side that changed it"]109+ same -- "Both, alike" --> take110+ same -- "Both, differently" --> conflict["Conflict: keep ours, note what theirs had"]111+```112+113+So two people editing different cells of one sheet, or one formatting a114+cell while the other retypes it, merge without conflicts. Sheets are115+matched by name, or by their cells when renamed (as `012 diff` matches116+them): a sheet renamed on one side and edited on the other merges both.117+A sheet removed on one side goes, unless the other side changed it,118+which is a conflict: ours stays (kept when ours changed it, gone when119+ours removed it). Sheets added on both sides under one name merge cell120+by cell.121+122+On conflicts the merge keeps ours for each, adds to the cell's note what123+theirs had (`Merge conflict, kept ours; theirs had input 11`), so the124+cells show the note's mark in the grid, lists them on standard error and125+exits 1:126+127+```128+012 merge-driver: 1 conflict in budget.012, where ours is kept; a cell's note says what theirs had:129+ Sheet1!B2 input: ours 12, theirs 11, base 10130+```131+132+Git then reports the file as conflicted. Open it in 012, fix the cells133+and delete the notes, then `git add` it; or take one side whole with134+`git checkout --ours` or `--theirs`. A merge that can't be made at all135+(a side that isn't a workbook, or a result the engine refuses, such as a136+named range left on a sheet the other side removed) leaves ours as it137+was and exits 2, which git also takes as a conflict.138+139+Two limits:140+141+- Inserting or deleting rows or columns moves every cell below or to142+ the right, which a merge by address can't tell from edits to those143+ cells. Merge such a change in 012 instead: open both versions and copy144+ across.145+- Trust in a file's commands follows [macros' rule](../sheets/macros.md#macros-from-other-computers):146+ the merged file keeps ours' trust only when its macros and regions'147+ commands are ours', or theirs were trusted on the same computer.148+ Otherwise the next time the file runs a command, 012 asks first.@@ -0,0 +1,147 @@
1+---2+title: "Scripts"3+sidebar_position: 64+---5+6+# Scripts7+8+Four commands read and change a `.012` workbook without the screen, for9+shell scripts, cron jobs, Makefiles and nushell pipelines:10+11+```sh12+012 get budget.012 B7 # a cell's value, as the sheet shows it13+012 get budget.012 'Q3 plan'!A1:C9 --format csv14+012 set budget.012 B7 '=SUM(A1:A6)' B8 1200 # type entries, then save15+012 recalc budget.012 # recalculate, save, list the errors16+012 export budget.012 budget.xlsx # what File > Download writes17+```18+19+None of them runs a program or reaches the network unless a flag asks:20+see [Regions and JEV functions](#regions-and-jev-functions). The flags21+and exit statuses of every command are in22+[Command line](../reference/command-line.md).23+24+## References25+26+A reference names cells as a formula does, with the sheet in front when27+it isn't the one shown when the file was saved:28+29+| Reference | Names |30+|---|---|31+| `B7`, `A1:C9`, `A:A`, `$B$7` | Cells of the sheet shown when the file was saved |32+| `Q3!B7`, `'Q3 plan'!A1:C9` | Cells of the sheet named, quoted as in formulas when the name has spaces (the shell needs quotes around it too) |33+| `Sales` | A [named range](../formulas/references.md) |34+| `Q3`, `Q3!` | The whole sheet, from A1 to its last cell with contents |35+36+A reference that names nothing says what the workbook has: `no sheet37+named "Q4" (sheets: Q1, Q2, Q3)`.38+39+## get40+41+`012 get file ref` writes the value of a cell, or a table of a range or42+sheet (the sheet shown when there's no reference). `--format` picks the43+form:44+45+| Format | One cell | A range or sheet |46+|---|---|---|47+| `text`, the default | As the cell shows it: `$1,200.00`, `9/29/2026`, `#DIV/0!` | Aligned columns, numbers to the right |48+| `csv`, `tsv` | One line | Rows as shown, in the workbook's [locale](../sheets/locale.md), as a CSV download |49+| `json` | The value: a number, a string, `true`, `null` for a blank cell | A list of records named by the range's first row |50+| `nuon` | The value with its nushell type: a date, a file size, a duration | A nushell table named by the range's first row |51+52+JSON and NUON type values by their cells' formats as a53+[NUON download](../nushell/types.md) does, and take the columns' names54+from the range's first row, as a table in 012 has its header there.55+`--no-header` names the columns by their letters instead (`A`, `B`) and56+makes the first row a record too. A filter doesn't hide rows from `get`:57+a script reads all the range holds.58+59+`--input` writes what was typed rather than what it computes: a60+formula, or an entry as the file stores it (numbers and dates in61+en-US's form whatever the workbook's locale), so62+`012 get budget.012 B7 --input` prints `=SUM(A1:A6)`.63+64+In nushell, NUON comes back as a table with its types:65+66+```nu67+012 get budget.012 A1:C9 --format nuon | from nuon | where amount > 10068+012 get budget.012 B7 --format nuon | from nuon # a number, not a string69+```70+71+## set72+73+`012 set file ref input [ref input ...]` types each input into its cell,74+in order, as one change, and saves the file atomically: into a temporary75+file beside it, renamed over it once complete. An empty input clears the76+cell's contents, keeping its formatting and note, as Delete does. A file77+that doesn't exist is created, as `012 budget.012` does.78+79+Inputs are what the file stores, not what the sheet's locale types: `1.5`80+and `=ROUND(A1, 2)` in every workbook, so a script means the same in a81+de-DE workbook as in an en-US one. Entries that imply a format (`$1,200`,82+`12%`, `2026-09-29`) set it, as typing them does.83+84+`set` stops, and leaves the file as it was, on the first input a cell85+can't take, naming the cell:86+87+| Refused | Says |88+|---|---|89+| A formula that doesn't parse | `Sheet1!B7: Expected , or ) in SUM, at character 11 of =SUM(A1:A6` |90+| An entry a validation rule rejects | the rule's help, as the context line would |91+| A cell of an array's result, a pivot table or a region | the same message as on the screen |92+| A cell in a [protected range](../sheets/notes-protection.md) | `Sheet1!B7 is protected (B1:B9): --force sets it anyway` |93+| A reference to a range, not one cell | `A1:B2 is the range A1:B2: name one cell` |94+95+An entry a rule only marks invalid is set, with a warning on standard96+error. An input that starts with `--` (a flag's shape) comes after `--`:97+`012 set budget.012 -- A1 --`.98+99+## recalc100+101+`012 recalc file` recomputes every formula, saves the file (leaving it102+untouched when nothing it stores changed) and lists each formula showing103+an error, one a line, with what the screen's context line says about it:104+105+```106+Q3!B7 #DIV/0! Division by zero in B6/C6107+Q3!D2 #N/A JEV functions need --jev and an API key to be answered108+```109+110+It exits 1 when any cell shows an error or a formula reads its own cell,111+so `012 recalc budget.012 && deploy` stops on a broken sheet.112+113+## export114+115+`012 export file out [ref]` writes the workbook in another format, as116+File > Download does: the format by `out`'s extension or `--format`117+(`csv`, `tsv`, `xlsx`, `sqlite`, `json`, `nuon`). XLSX gets every sheet;118+the others get the sheet shown, or `ref`'s range or sheet. SQLite writes119+a table named by `--table`, replacing one of that name. Formulas are120+written as their values where the format has no formulas, and a note on121+standard error says how many. CSV, TSV, JSON and NUON leave out the rows122+a filter hides, as a download does.123+124+## Regions and JEV functions125+126+A `.012` file stores what was typed and computes the rest, so a few127+things need more than the file:128+129+- **Notebook regions' tables** come from their nushell commands, which130+ these commands don't run: a region's table is empty, and `get` says so131+ on standard error. `--regions` runs every region's command, each after132+ those it reads, as Run all regions (F9) does. As on the screen, a133+ [file saved on another computer](../nushell/notebooks.md#saving-and-trust)134+ asks first: `--regions` refuses it unless `--trust` gives the answer135+ Run would, and `recalc --regions --trust` saves that trust in the file136+ as the screen does, so later runs don't need it. `shell = off` in the137+ [configuration](../reference/config.md#shell) turns `--regions` off,138+ `shell = on` runs every file's commands, and each command times out139+ after `nu-timeout`.140+- **[Linked files](following.md)** are followed only on the screen; their141+ regions are empty here.142+- **[JEV functions](../formulas/jev.md)** ask a hosted model over the143+ network, and show `#N/A` here unless `--jev` asks it, with the API key144+ from the environment, the credential store or `jev-api-key-command`.145+146+`get`, `recalc` and `export` take these flags; `set` computes values only147+to check entries.@@ -18,6 +18,8 @@ go install github.com/FelineStateMachine/012/cmd/012@latest
1818 012 sales.xlsx # import .xlsx, .csv, .tsv, .json, .nuon, .sqlite, .parquet or Lotus .wk11919 012 - < sales.csv # a table from standard input2020 012 serve ~/sheets # serve a directory over SSH, a 012 per session21+012 get budget.012 B7 # a cell's value, for scripts22+012 diff old.012 new.012 # what changed, cell by cell2123 ```2224 2325 A file on the command line opens as File > Open would: a `.012` sheet, or@@ -25,7 +27,12 @@ another format imported ([files](../files/README.md)). `012 -` and
2527 `012 --pipe`, 012 as a stage in a pipeline, are in2628 [Pipelines](../nushell/pipelines.md), and `012 nu`, a nushell notebook,2729 in [Notebooks](../nushell/notebooks.md). `012 serve` is28-described in [Serving over SSH](../terminal/ssh.md).30+described in [Serving over SSH](../terminal/ssh.md). `012 get`, `set`,31+`recalc` and `export` work on a workbook without the screen32+([scripts](../files/scripts.md)), and `012 diff` and `012 merge-driver`33+compare and merge workbooks, in git too ([diff and merge in34+git](../files/git.md)). Every command is in35+[Command line](../reference/command-line.md).2936 3037 `012 config` prints the settings in effect and `012 config edit` opens the3138 settings file ([configuration](../reference/config.md)). 012 draws in your@@ -115,3 +115,23 @@ authors = $commits | group-by author --to-table | update items { length } | rena
115115 works on it in the sheet. The pattern is the one nushell's cookbook116116 explains in [Parsing git117117 log](https://www.nushell.sh/cookbook/parsing_git_log.html).118+119+## A workbook read and written from a script120+121+[`012 get` and `012 set`](../files/scripts.md) work on a workbook file122+without the screen, so a nushell script can read a range with its types,123+compute, and write results back:124+125+```nu126+let sales = ^012 get budget.012 'Q3!A1:C40' --format nuon | from nuon127+let total = $sales | where region == West | get amount | math sum128+^012 set budget.012 'Summary!B2' ($total | into string) 'Summary!B3' (date now | format date '%Y-%m-%d')129+^012 recalc budget.012130+```131+132+`012 recalc` exits 1 when a formula shows an error, so a script stops133+there. What changed between two versions comes back as a table too:134+135+```nu136+^012 diff last-week.012 budget.012 --format nuon | from nuon | where field == value137+```@@ -11,3 +11,4 @@ sidebar_position: 1
1111 | [Functions](functions.md) | Every function, generated from the engine |1212 | [Configuration](config.md) | The config file, `012 config` and every option, generated from the registry |1313 | [Macro scripting API](macro-api.md) | The functions and command ids macros can use |14+| [Command line](command-line.md) | Every command, its flags and exit statuses |@@ -0,0 +1,63 @@
1+---2+title: "Command line"3+sidebar_position: 64+---5+6+# Command line7+8+Every way to start 012, with the page that describes each. A file named9+like a command (`get`, `diff`) opens as `./get`.10+11+## With the screen12+13+| Command | Does |14+|---|---|15+| `012 [flags] [file]` | Opens a `.012` workbook (created on saving when it doesn't exist), or imports another format: [Files](../files/README.md) |16+| `012 [flags] -` | A table from standard input: [Pipelines](../nushell/pipelines.md) |17+| `012 [flags] --pipe [--to nuon\|json\|csv\|tsv] [--send ask\|selection\|sheet] [file]` | On quitting, sends a table to standard output: [Pipelines](../nushell/pipelines.md) |18+| `012 nu [flags] [file]` | A nushell notebook, at its prompt: [Notebooks](../nushell/notebooks.md) |19+| `012 serve [flags] [dir]` | Serves the sheets in a directory over SSH: [Serving over SSH](../terminal/ssh.md) |20+21+The flags are the options' flags, listed in [Configuration](config.md#options).22+23+## Without the screen24+25+| Command | Does |26+|---|---|27+| `012 get file.012 [ref]` | Writes a cell's value, or a range or sheet as a table: [Scripts](../files/scripts.md#get) |28+| `012 set file.012 ref input [ref input ...]` | Types entries into cells and saves: [Scripts](../files/scripts.md#set) |29+| `012 recalc file.012` | Recalculates, saves and lists the cells showing errors: [Scripts](../files/scripts.md#recalc) |30+| `012 export file.012 out [ref]` | Writes the workbook, a sheet or a range in another format: [Scripts](../files/scripts.md#export) |31+| `012 diff a.012 b.012` | Lists what changed, cell by cell: [Diff and merge in git](../files/git.md#012-diff) |32+| `012 diff --textconv file.012` | Writes a workbook as lines, for git's textconv: [Diff and merge in git](../files/git.md#git) |33+| `012 merge-driver base ours theirs [path]` | Merges theirs into ours, for git: [Diff and merge in git](../files/git.md#merging) |34+| `012 nu --module`, `012 nu --install-module [--force] [path]` | Prints or installs the nushell module: [Nushell](../nushell/README.md#install-the-sheet-command) |35+| `012 config [path\|edit\|default\|themes\|set-key\|delete-key]` | The settings: [Configuration](config.md#commands) |36+| `012 version` | Prints the version |37+38+`get`, `set`, `recalc`, `export`, `diff` and `merge-driver` take their39+flags anywhere after the command's name, and `--help` prints their40+usage. `--` ends the flags, so what follows is taken as it is41+(`012 set book.012 -- A1 --`), and an argument such as `-5` is never a42+flag.43+44+| Flag | Commands | Does |45+|---|---|---|46+| `--format text\|csv\|tsv\|json\|nuon` | `get` | The form of what's written; text by default |47+| `--input` | `get` | What was typed (a formula) rather than its value |48+| `--no-header` | `get` | JSON and NUON columns named by their letters, the first row a record |49+| `--force` | `set` | Sets cells in protected ranges |50+| `--format kind`, `--table name` | `export` | The format when the file's extension doesn't say; SQLite's table |51+| `--regions` | `get`, `recalc`, `export` | Runs the notebook regions' commands first, when the file is trusted here |52+| `--trust` | with `--regions` | Runs the commands of a file saved on another computer |53+| `--jev` | `get`, `recalc`, `export` | Asks JEV for the JEV functions' answers first |54+| `--format text\|json\|nuon` | `diff` | The form of the changes; text by default |55+| `--color auto\|always\|never` | `diff` | Colors the text; auto colors on a terminal or git's pager unless `NO_COLOR` is set |56+57+## Exit status58+59+| Status | Means |60+|---|---|61+| 0 | Done; for `diff`, the workbooks are the same |62+| 1 | An error, said on standard error; for `recalc`, cells show errors (after saving); for `diff`, the workbooks differ; for `merge-driver`, conflicts; for `get`, `recalc` and `export` with `--regions`, a region's command failed (after writing) |63+| 2 | The command was used wrongly (its usage is printed); for `diff` and `merge-driver`, trouble reading or merging the files |@@ -72,8 +72,8 @@ func writeText(w io.Writer, changes []Change, color bool) error {
7272 return bw.Flush()7373 }7474 75-// sheetText is the end of a sheet's line: where it was renamed or moved76-// from.75+// sheetText is the end of a sheet's line: its name or place in the76+// first workbook, for a sheet renamed or put elsewhere.7777 func sheetText(c Change) string {7878 switch c.Field {7979 case "renamed":