wx: run scripts at boot via the engine (--source / --batch)
Now that core has run_script, wire WxFrontend::BootDispatch's `source` to it instead of the "no script interpreter" note. `essim --source bring-up.essim` (and with --batch) now executes the script in the wx frontend too, accumulating the same output the tui produces into the console buffer surfaced by DumpOutput. Verified: `essim --batch --source script.essim` (wx) runs load + set-signal-type + verify and prints the source summary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "frontends/wx/wx_frame.hpp"
|
||||
|
||||
#include "core/app/script.hpp"
|
||||
#include "core/domain/connect.hpp"
|
||||
#include "core/domain/modules.hpp"
|
||||
#include "core/domain/persist.hpp"
|
||||
@@ -74,8 +75,15 @@ void WxFrontend::BootDispatch(const std::string &raw) {
|
||||
+ std::to_string(sys_->connections()->size())
|
||||
+ " connection(s))\n";
|
||||
} else if (cmd == "source") {
|
||||
output_ += "source: the wx frontend has no script interpreter "
|
||||
"(use the tui frontend for scripts).\n";
|
||||
ensure_system();
|
||||
std::ostringstream out;
|
||||
app::ScriptResult r = app::run_script(sys_, arg, out);
|
||||
output_ += out.str();
|
||||
if (!r.ok)
|
||||
output_ += "source: " + r.error + "\n";
|
||||
else
|
||||
output_ += "source: " + arg + " (" + std::to_string(r.lines)
|
||||
+ " line(s), " + std::to_string(r.errors) + " error(s))\n";
|
||||
} else if (!cmd.empty()) {
|
||||
output_ += "boot: ignored '" + raw + "'.\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user