handleMailCommand method
/mail - the deferred-panel history; /mail <id> - one panel in
full with its reply prefill.
Implementation
Future<void> handleMailCommand(String rest) async {
final id = rest.trim();
if (id.isEmpty) {
if (_hubPanels.panels.isEmpty) {
io.writeln(
'no deferred messages (mail/scheduled/steering panels appear '
'here when they land mid-run)',
);
return;
}
for (final panel in _hubPanels.panels) {
final preview = panel.body.replaceAll('\n', ' ');
io.writeln(
'${panel.id.padRight(7)} ${deferredPanelKindLabel(panel.kind)} '
'from ${panel.from} · ${panel.state.name} · '
'${preview.length > 60 ? preview.substring(0, 60) : preview}',
);
}
io.writeln(
_style.dim(
'/mail <id> - full panel · /reply <id|address> <text> - answer',
),
);
return;
}
final panel = _hubPanels[id];
if (panel == null) {
io.writeln('no panel "$id" (bare /mail lists ids)');
return;
}
for (final line in deferredPanelLines(panel, width: _hubBlockWidth)) {
io.writeln(line);
}
final prefill = replyPrefillFor(panel);
if (prefill != null) io.writeln(_style.dim(prefill));
}