mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-27 12:34:14 +02:00
b034b1a634
The wiring_list_view added by this slice was only reachable through the GUI,
which meant the one thing worth proving about it -- that it still describes
the project -- could not be checked without a person clicking. This is the
same shape as the existing --export-bom, which reads
element_nomenclature_view, and it makes the view verifiable in CI.
It also makes this slice useful on its own: a from-to wiring list is a thing
people want as a CSV, and it no longer waits on the dialog in the next slice.
There is deliberately an overlap with --export-cables, which produces the same
logical list from the document XML rather than the database. Keeping both is
the point: running them and diffing them is a direct check that the cache and
the document still agree, which nothing else in the codebase can do.
Measured on the example corpus, the two also differ in what they can actually
fill in. Rows carrying any endpoint data:
--export-cables --export-wiring
industrial.qet 0 / 671 541 / 671
m_000.qet 0 / 457 362 / 457
affuteuse_250h.qet 0 / 263 197 / 263
tremie_vibrante.qet 0 / 77 61 / 77
tableau_domestique.qet 58 / 130 104 / 130
Both return a row per conductor; the XML-derived one leaves the component and
terminal columns empty on the older projects, and emits an unresolved "%id"
in its folio column. That is not an argument for removing it -- it carries
columns the view does not, and it is the independent second opinion -- but it
does mean the database path is the one with the data on the projects people
actually have.
The terminal-name columns come back empty on most projects. That is absent
source data, not a loss in transit: tableau_domestique.qet has no terminal
name on 457 of 457 terminals, and industrial.qet stores the "_" placeholder
on 1421 of 1790.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
86 lines
3.4 KiB
C++
86 lines
3.4 KiB
C++
/*
|
|
Copyright 2006-2025 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef CLI_EXPORT_H
|
|
#define CLI_EXPORT_H
|
|
|
|
#include <QStringList>
|
|
|
|
/**
|
|
@brief Headless command-line export.
|
|
|
|
Implements the long-requested batch/headless export
|
|
(qelectrotech.org bugtracker #171, GitHub #309): render a project's
|
|
diagrams to files without opening the GUI.
|
|
|
|
Detected and handled in main() before the GUI is created.
|
|
*/
|
|
namespace CLIExport {
|
|
|
|
/**
|
|
@brief True if @p args request a CLI export
|
|
(i.e. contain one of the export options).
|
|
*/
|
|
bool isExportRequest(const QStringList &args);
|
|
|
|
/**
|
|
@brief Run the CLI export described by @p args.
|
|
@return process exit code (0 on success).
|
|
|
|
Usage:
|
|
qelectrotech --export-pdf <project.qet> <output.pdf>
|
|
qelectrotech --export-png <project.qet> <output_dir>
|
|
qelectrotech --export-svg <project.qet> <output_dir>
|
|
qelectrotech --export-cables <project.qet> <output.csv>
|
|
qelectrotech --export-wires <project.qet> <output.csv>
|
|
qelectrotech --export-bom <project.qet> <output.csv>
|
|
qelectrotech --export-wiring <project.qet> <output.csv>
|
|
qelectrotech --export-nets <project.qet> <output.json>
|
|
qelectrotech --export-links <project.qet> <output.csv>
|
|
qelectrotech --info <project.qet> [output.json]
|
|
qelectrotech --check-elements <element.elmt | directory>
|
|
qelectrotech --resave <project.qet> <output.qet>
|
|
qelectrotech --set-titleblock <project.qet> <output.qet> key=value...
|
|
|
|
PDF: one multi-page document (one diagram per page).
|
|
PNG/SVG: one file per diagram, named <output_dir>/<NN>_<title>.<ext>.
|
|
cables: wiring list (one row per conductor) as CSV.
|
|
wires: list of distinct wire numbers as CSV.
|
|
bom: bill of materials (one row per element) as CSV.
|
|
wiring: from-to wiring list (one row per conductor) as CSV, read from
|
|
the project database. Same logical list as `cables`, which
|
|
reads the document XML instead; the two are meant to agree,
|
|
so diffing them checks that the database still describes the
|
|
project.
|
|
nets: electrical nets (connected-terminal groups) as JSON.
|
|
links: element cross-references (coil/contact) as CSV, with
|
|
unresolved links flagged.
|
|
info: structural project summary as JSON (stdout, or a file) —
|
|
per-page element / conductor counts and unconnected terminals.
|
|
check-elements: validate .elmt file(s) against the element schema.
|
|
resave: load and rewrite the project XML (round-trip integrity).
|
|
set-titleblock: stamp title-block fields onto every folio, then save.
|
|
Keys: title, author, date (or date=today), plant, location,
|
|
revision, version, filename; any other key becomes a custom
|
|
field. E.g. --set-titleblock in.qet out.qet revision=B date=today
|
|
*/
|
|
int run(const QStringList &args);
|
|
|
|
}
|
|
|
|
#endif // CLI_EXPORT_H
|