Export command (CSV + ODS), file dialog, error modal, path persistence.

New user-facing features:
- `export connections <file>` writes a tabular dump of every wire pair:
  connection, transform, left/right module/part/pin/signal/type/suspect,
  mixed-types flag. Dispatch on extension: `.csv` (flat file) or `.ods`
  (one sheet per connection). Any other extension shows an error and
  writes nothing.
- Bare `export` (or dashboard `[x]`, or palette `export`) opens an
  interactive file-picker dialog with a CSV/ODS toggle at the top.
  Picking a filter rewrites the filename's extension. Last-used
  directory and filename are remembered per-call-site.
- Two new CLI flags on the binary: `--source FILE` to run a script at
  boot, `--restore FILE` to restore a snapshot at boot. Combinable.

Reusable infrastructure:
- `OdsWriter` (`src/imports/ods_writer.{hpp,cpp}`): minimal .ods writer
  using libzip + pugixml (already in the build for the importer).
  Multi-sheet workbook of string cells. ~180 lines, no new dep.
- Generic file-picker dialog (`screen_filedialog.cpp`): one Modal
  reused for any "pick a path" interaction via
  `OpenFileDialog(title, persist_key, default_filename, filters, cb)`.
  Validates the picked extension against the filter whitelist;
  unknown ones stay in the dialog with a status message. Persists
  (dir, filename) per `persist_key`.
- Generic error modal (`screen_error.cpp`, `ShowError(msg)`): centred
  red-titled popup, dismissable with Esc/Enter. Used by the export
  failures (open-for-write, ODS save, unknown extension/kind);
  ready for adoption elsewhere.
- Per-key path persistence (`SaveLastUsed`/`LoadLastUsed` in
  `shell.cpp`): two-line file per key under the user-data dir.
- `UserDataDir()` extracted from the history path helper so the new
  per-key persistence shares the same XDG/AppData logic.
- New help-screen topic "Export"; user-facing `doc/user/analysis.md`
  gains an "Exporting" section; `DESIGN.md` gains a generics
  section covering the dialog / error modal / persistence / ODS
  writer; `DumpCommandsMd` now respects the `hidden` flag (the
  `connect` alias no longer appears in the auto-gen reference).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 12:03:39 +02:00
parent f62f4a0c9b
commit 7d307dad57
18 changed files with 1085 additions and 103 deletions

View File

@@ -13,7 +13,43 @@ history.
## Interactive commands
### `connect` *(interactive)*
### `dashboard` *(interactive)*
open the dashboard (system overview)
**No arguments.**
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
- not recorded by `script-save` and rejected by `source`
---
### `explore` *(interactive)*
browse modules → parts/signals/connections → details (interactive)
**No arguments.**
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
- not recorded by `script-save` and rejected by `source`
---
### `export` *(interactive)*
export structured data to CSV (kinds: connections; bare form opens the file-picker dialog)
**Arguments**
1. `kind [connections]`
2. `filename (.csv)` *(Tab → path completion)*
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
---
### `plug` *(interactive)*
connect a part across two modules (interactive screen if no args)
@@ -29,47 +65,7 @@ connect a part across two modules (interactive screen if no args)
- bare form opens an interactive screen; inline form (all args) is scriptable
---
### `explore` *(interactive)*
browse modules → parts/signals/connections → details (interactive)
**No arguments.**
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
- not recorded by `script-save` and rejected by `source`
---
### `net` *(interactive)*
show all signals reachable from <module>/<signal> through connections (interactive screen if no args)
**Arguments**
1. `module`
2. `signal name`
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
---
### `search` *(interactive)*
list parts/signals matching a pattern (interactive screen if no args)
**Arguments**
1. `module`
2. `kind [parts|signals]`
3. `pattern`
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
---
### `set-type` *(interactive)*
### `set-connector-type` *(interactive)*
tag a part's connector type for transform lookup
@@ -87,6 +83,12 @@ tag a part's connector type for transform lookup
## Other commands
### `analyze`
detect signal groups (diff pairs, buses) and structural anomalies
**No arguments.**
---
### `clear`
clear the visualization area
@@ -115,7 +117,7 @@ leave essim (alias of quit)
---
### `help`
show command help (optionally for a specific command)
list commands (or `help <name>` for one command's details)
**Arguments**