formatSyncProgress function

String? formatSyncProgress(
  1. ProgressEvent e
)

Formats a sync ProgressEvent as a per-path status line for in-session display above the prompt, or null when there is nothing useful to show.

Emits one line per file as it settles — ↑ path (4.1 KB → 1.2 KB wire) for an upload, ≡ path (deduped) for a server-side copy, - path (removed) for a delete — and pushing… for coarse git phases. In-flight started/ progress events and the bulk count event are suppressed (a carriage-return bar would fight the prompt); the terminal done phase yields null.

Implementation

String? formatSyncProgress(ProgressEvent e) {
  if (e.phase == ProgressPhase.done) return null;
  final state = e.itemState;
  final path = e.path;
  if (state != null && path != null) {
    if (state != ProgressItemState.completed) return null;
    return _itemSummaryLine(e, path);
  }
  // No per-item info: a coarse git phase message, or the bulk count event (whose
  // detail the per-path lines above already carry).
  if (e.total == null) {
    return e.message.isEmpty ? null : '${e.message}…';
  }
  return null;
}