tui: add --batch mode to run a script and print output headless

BootDispatch already runs --restore/--source synchronously before the TUI
starts (Source takes its headless drain branch when no screen is attached),
so the console buffer is complete by then. New --batch flag dumps that buffer
(Tui::DumpOutput) to stdout and exits without launching the TUI — enabling
scripted/CI runs and verify output capture (e.g. essim --batch --source s).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 15:36:41 +02:00
parent 952afe3979
commit 7cec6e1b0c
3 changed files with 24 additions and 1 deletions

View File

@@ -36,6 +36,11 @@ void Tui::Print(const std::string &line) {
scroll_offset = 0; // any new line snaps the view back to the tail
}
void Tui::DumpOutput(std::ostream &out) const {
for (const std::string &line : output)
out << line << "\n";
}
void Tui::HistoryUp() {
if (history.empty()) return;
if (history_idx == -1) history_idx = (int)history.size() - 1;