Files
essim/doc/user/commands.md
François 7d307dad57 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>
2026-05-16 12:03:39 +02:00

245 lines
4.2 KiB
Markdown

# essim — command reference
Auto-generated from the live command registry. Regenerate with
`cmake --build build --target doc` after adding or changing
commands; the binary itself is the single source of truth.
Keys global to the shell: `Esc` cancels a multi-step prompt or
leaves an interactive screen; `Tab` completes commands/paths
(top-level prompt) or cycles focus inside an interactive
screen; `PageUp` / `PageDown` scroll output by 10 lines,
`Home` / `End` jump to top / bottom; ↑ / ↓ walk command
history.
## Interactive commands
### `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)
**Arguments**
1. `module1`
2. `part1 (name or pattern)`
3. `module2`
4. `part2 (name or pattern)`
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
---
### `set-connector-type` *(interactive)*
tag a part's connector type for transform lookup
**Arguments**
1. `module`
2. `part (name or pattern)`
3. `connector type (free string, e.g. vpx-bp, vpx-payload)`
**Notes**
- bare form opens an interactive screen; inline form (all args) is scriptable
---
## Other commands
### `analyze`
detect signal groups (diff pairs, buses) and structural anomalies
**No arguments.**
---
### `clear`
clear the visualization area
**No arguments.**
---
### `duplicate`
clone a module under a new name (parts, pins, signals; no connections)
**Arguments**
1. `source module`
2. `new module name`
**Notes**
- missing args trigger one prompt each
---
### `exit`
leave essim (alias of quit)
**No arguments.**
---
### `help`
list commands (or `help <name>` for one command's details)
**Arguments**
1. `command name (optional)` *(Tab → command completion)*
**Notes**
- no per-arg prompt: pass all args inline (or run bare for an empty-args path)
---
### `load`
load a module from a netlist / pinout file (mentor, altium, ods)
**Arguments**
1. `module name`
2. `filename` *(Tab → path completion)*
3. `import type [mentor|altium|ods]`
**Notes**
- missing args trigger one prompt each
---
### `new`
create a new (empty) system; resets the script-save buffer and $vars
**No arguments.**
---
### `quit`
leave essim
**No arguments.**
---
### `restore`
replace the current system with a saved snapshot
**Arguments**
1. `filename` *(Tab → path completion)*
**Notes**
- missing args trigger one prompt each
---
### `save`
write the current system snapshot to a file
**Arguments**
1. `filename` *(Tab → path completion)*
**Notes**
- missing args trigger one prompt each
---
### `script-save`
write commands run since last 'new' as a replay-ready script
**Arguments**
1. `filename` *(Tab → path completion)*
**Notes**
- missing args trigger one prompt each
---
### `set`
define a $variable for substitution in subsequent commands (no args = list defined vars)
**Arguments**
1. `name`
2. `value`
**Notes**
- no per-arg prompt: pass all args inline (or run bare for an empty-args path)
---
### `set-signal-type`
override the auto-detected signal type (power | gnd | other)
**Arguments**
1. `module`
2. `signal name`
3. `type [power|gnd|other]`
**Notes**
- missing args trigger one prompt each
---
### `source`
execute a file of commands line by line (interactive cmds rejected)
**Arguments**
1. `filename` *(Tab → path completion)*
**Notes**
- missing args trigger one prompt each
---
### `verify`
check pin roles locally and signal-type consistency across bridged nets
**No arguments.**
---