JOINUS-D Command Line Interface (CLI)¶
JOINUS-D can be driven from the command line, without opening the windowed application. This is useful for scripting and batch conversions.
The CLI is activated automatically whenever the executable is called with at
least one argument (argc > 1); with no arguments, the windowed application
starts instead.
Usage¶
Options¶
| Flag | Long form | Argument | Description |
|---|---|---|---|
-h |
--help |
— | Displays the help menu and exits. |
-v |
--version |
— | Displays the current application version and exits. |
-i |
--input |
FILE |
Input file. Required for any conversion. |
-o |
--output |
FILE |
Output file. Required for any conversion. |
-s |
--subcircuit |
[NAME] (optional) |
Converts the circuit to a subcircuit. If NAME is omitted, the subcircuit is named unnamed. |
-g |
--group |
— | Groups components by type in the generated netlist. |
-j |
--jsim |
— | Converts for the JSIM simulator. By default (no -j), converts for JoSIM. |
-wc |
--without-console |
— | Suppresses console output of the conversion result. |
-wf |
--without-file |
— | Suppresses writing the result to the output file. |
| — | --vcc |
VALUE |
Overrides the VCC value (e.g. 2.5m) for this conversion only. |
| — | --header |
TEMPLATE |
Overrides the header template for this conversion only, and forces the header on regardless of the saved preference. |
| — | --no-header |
— | Forces the header off for this conversion only. |
-e |
--expand |
— | Inlines referenced subcircuits into the netlist for this conversion only, instead of .include-ing them. Only affects JoSIM output — JSIM always inlines them regardless of this flag. |
-h/--help and -v/--version short-circuit the command: if either is
present, all other flags are ignored.
Unlike the windowed application, the CLI does not run a simulator or open any
plot window — it only converts. There is no -r/--run or -p/--plot
equivalent (see Limits and errors for what the CLI does
and does not do).
Per-run setting overrides (--vcc, --header, --no-header, -e)¶
VCC value, header (on/off + template), and circuit expansion are normally persistent preferences — set once in Preferences (or, for circuit expansion, the "Replace .include by Subcircuits" checkbox in the Conversion Parameters panel) and reused for every conversion after that, GUI or CLI.
These four flags let a single CLI invocation override one of those values for
this run only. Unlike the windowed application (which reads these from
AppConfig::conversion()), the CLI builds its own one-off ConversionParams
from the command line each time — there's no global state to save and
restore, so using these flags never touches your saved Preferences or affects
any other run.
--vcc VALUEoverrides the VCC value used in the generated netlist.--header TEMPLATEoverrides the header template text, and also forces the header on for this run (even if "include header" is off in your saved preferences) — otherwise supplying a template would have no visible effect.--no-headerforces the header off for this run, overriding the saved "include header" preference.-e/--expandforces circuit expansion on for this run.
--header and --no-header are mutually exclusive; if both are given,
--header takes precedence.
What "expand" actually does: when the circuit uses a subcircuit (e.g. a
superconductor mock component), the producer normally writes a
.include <path-to-subcircuit-file> line pointing at the external .cir
file — the netlist stays small, but that file has to travel with it.
-e/--expand instead reads the subcircuit file's content and pastes it
directly into the netlist (recursively, so a subcircuit that references
another subcircuit gets pulled in too), producing one self-contained file
with no external dependencies. This only has an effect on JoSIM output —
JSIM output is always fully expanded regardless of this flag, so -e is a
no-op together with -j.
For a circuit that uses a subcircuit called MySubcircuit, the relevant
line(s) of the generated netlist look like this:
Without -e (JoSIM default) — a reference to the external file:
With -e — the contents of MySubcircuit.cir pasted in directly:
Conversion modes¶
JOINUS-D picks the conversion direction from the file extensions of -i and
-o:
- LibrePCB → SPICE: input file has the
.lpextension. Output is written as a SPICE netlist (JoSIM or JSIM, depending on-j). - Back-annotation, SPICE → LibrePCB: input file has the
.cirextension and output file has the.lpextension. The existing.lpfile (given as-o) is updated in place using the values from the.cirnetlist.
Any other combination of extensions is rejected with an explanatory message and a non-zero exit code.
Flag argument parsing — caveat¶
-i, -o, and -s all consume the token immediately following them as
their argument. There is no check that this token isn't itself another flag.
For example:
parses -o as the subcircuit name (not as the --output flag), which is
almost certainly not what you want. Always give -s an explicit name or
place it last among the option flags:
Limits and errors¶
- No more than 15 arguments are accepted (
argc <= 16, which includes the program name); exceeding this raisesToo many input parameters!. This check runs before the-h/-vshort-circuit below, soJOINUS-D -hfollowed by more than 15 junk arguments raises this error instead of printing help. -iand-oare both mandatory for a conversion (not needed for-h/-v); omitting either raisesInput and output files must be provided!.- An unsupported combination of input/output extensions prints an
explanatory message and returns exit code
1. - If the output file cannot be written,
Cannot save the output fileis printed and the process returns exit code1. - On success,
Converted successfully!is printed and the process returns exit code0. - Note: the "too many parameters" and "missing input/output" checks raise a C++ exception that is not currently caught by the CLI, so the process aborts rather than exiting cleanly. Avoid relying on a specific exit code for these two cases in scripts — check stderr/output instead.
- There is no
-r/--run(simulate) or-p/--plotoption: the CLI only converts. Running a simulator and viewing plots requires the windowed application.
Examples¶
Display the help menu:
Display the current version:
Convert a LibrePCB circuit to a SPICE netlist (JoSIM by default):
Convert to a SPICE netlist for the JSIM simulator instead:
Convert to a named subcircuit:
Convert to an unnamed subcircuit (defaults to unnamed):
Convert while grouping components by type:
Combine subcircuit conversion, JSIM simulator, and component grouping:
Convert without writing an output file (print to console only):
Convert without console output (write to file only, e.g. for scripting):
Back-annotate an edited SPICE netlist into the original LibrePCB circuit:
Convert with a one-off VCC value, without changing the saved preference:
Convert with a custom header for this run only (forces the header on):
Convert without a header for this run only:
Convert with the circuit expanded, for this run only:
Notes¶
- The windowed application is documented in the JOINUS-D User Manual.
- JOINUS-D's CLI is the same as L2SPICE's, minus the
-r/--runand-p/--plot(simulate/plot) options — JOINUS-D's CLI only converts. - The exact behavior is implemented in
console/console_app.cpp(flag parsing and dispatch); the-h/--helptext lives inassets/settings/help.txt.