formatSyncProgress function
Formats a sync ProgressEvent as a compact one-line status for in-session
display above the prompt, or null when there is nothing useful to show.
Returns syncing 5/7: path for per-file directory progress and pushing…
for coarse git phases; the terminal done phase yields null (callers
print their own final summary).
Implementation
String? formatSyncProgress(ProgressEvent e) {
if (e.phase == ProgressPhase.done) return null;
final total = e.total;
final completed = e.completed;
if (total == null || completed == null) {
return e.message.isEmpty ? null : '${e.message}…';
}
if (total == 0) return null;
final path = e.message.isEmpty ? '' : ': ${e.message}';
return 'syncing $completed/$total$path';
}