From a1be7e9a369c1d038428a9d0b56ad0eb5d407441 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 19 Nov 2024 13:05:00 +0100 Subject: [PATCH] make summary more concise the verbose summary was actually hard to read due to the numbers getting lost between the words. i considered highlighting the numbers using ansi escapes, but the irregular structure would be still hard to parse, and the escapes would be unsuitable for log files. also considered was clustering the numbers at the beginnings of the lines, but that would result in a messy sentence structure. a proper tabular format would introduce a lot more spacing, and would be a lot harder to implement for little tangible benefit. i tried just using the progress counter format, but with plain numbers instead of the "x/y", but it looked kinda stupid. so instead use a slightly expanded, semi-tabular version of that, as suggested by Akshay Hegde on the list. this format bears a risk of exceeding 80 columns, and in log files the internal spacing looks kinda out of place, but these should be minor issues in practice. amends a1a3313e. REF: --- src/main_sync.c | 32 ++++---------------------------- src/mbsync.1.in | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/main_sync.c b/src/main_sync.c index afd136e..2ea4a92 100644 --- a/src/main_sync.c +++ b/src/main_sync.c @@ -9,7 +9,6 @@ #define nz(a, b) ((a) ? (a) : (b)) -static int ops_any[2], trash_any[2], expunge_any[2]; static int chans_total, chans_done; static int boxes_total, boxes_done; @@ -84,25 +83,10 @@ summary( void ) if (!boxes_done) return; // Shut up if we errored out early. - printf( "Processed %d box(es) in %d channel(s)", boxes_done, chans_done ); - for (int t = 2; --t >= 0; ) { - if (ops_any[t]) - printf( (DFlags & DRYRUN) ? - ",\nwould %s %d new message(s) and %d flag update(s)" : - ",\n%sed %d new message(s) and %d flag update(s)", - str_hl[t], new_done[t], flags_done[t] ); - if (trash_any[t]) - printf( (DFlags & DRYRUN) ? - ",\nwould move %d %s message(s) to trash" : - ",\nmoved %d %s message(s) to trash", - trash_done[t], str_fn[t] ); - if (expunge_any[t]) - printf( (DFlags & DRYRUN) ? - ",\nwould expunge %d message(s) from %s" : - ",\nexpunged %d message(s) from %s", - expunge_done[t], str_fn[t] ); - } - puts( "." ); + printf( "Channels: %d Boxes: %d Far: +%d *%d #%d -%d Near: +%d *%d #%d -%d\n", + chans_done, boxes_done, + new_done[F], flags_done[F], trash_done[F], expunge_done[F], + new_done[N], flags_done[N], trash_done[N], expunge_done[N] ); } static int @@ -244,14 +228,6 @@ add_channel( chan_ent_t ***chanapp, channel_conf_t *chan, int ops[] ) free( ce ); return NULL; } - if (chan->ops[t] & OP_MASK_TYPE) - ops_any[t] = 1; - if (chan->ops[t] & (OP_EXPUNGE | OP_EXPUNGE_SOLO)) { - expunge_any[t] = 1; - if (chan->stores[t]->trash || - (chan->stores[t^1]->trash && chan->stores[t^1]->trash_remote_new)) - trash_any[t] = 1; - } } **chanapp = ce; diff --git a/src/mbsync.1.in b/src/mbsync.1.in index fba3669..032918b 100644 --- a/src/mbsync.1.in +++ b/src/mbsync.1.in @@ -802,7 +802,7 @@ No attempt is made to calculate the totals in advance, so they grow over time as more information is gathered. .P Irrespective of output redirection, \fBmbsync\fR will print a summary -of the above in plain language upon completion, except in quiet mode. +of the above upon completion, except in quiet mode. . .SH RECOMMENDATIONS Make sure your IMAP server does not auto-expunge deleted messages - it is