Browse Source

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: <ZzwSfSZN-lNNK55D@akshay.is>
master
Oswald Buddenhagen 1 month ago
parent
commit
a1be7e9a36
  1. 32
      src/main_sync.c
  2. 2
      src/mbsync.1.in

32
src/main_sync.c

@ -9,7 +9,6 @@
#define nz(a, b) ((a) ? (a) : (b)) #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 chans_total, chans_done;
static int boxes_total, boxes_done; static int boxes_total, boxes_done;
@ -84,25 +83,10 @@ summary( void )
if (!boxes_done) if (!boxes_done)
return; // Shut up if we errored out early. return; // Shut up if we errored out early.
printf( "Processed %d box(es) in %d channel(s)", boxes_done, chans_done ); printf( "Channels: %d Boxes: %d Far: +%d *%d #%d -%d Near: +%d *%d #%d -%d\n",
for (int t = 2; --t >= 0; ) { chans_done, boxes_done,
if (ops_any[t]) new_done[F], flags_done[F], trash_done[F], expunge_done[F],
printf( (DFlags & DRYRUN) ? new_done[N], flags_done[N], trash_done[N], expunge_done[N] );
",\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( "." );
} }
static int static int
@ -244,14 +228,6 @@ add_channel( chan_ent_t ***chanapp, channel_conf_t *chan, int ops[] )
free( ce ); free( ce );
return NULL; 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; **chanapp = ce;

2
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. time as more information is gathered.
.P .P
Irrespective of output redirection, \fBmbsync\fR will print a summary 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 .SH RECOMMENDATIONS
Make sure your IMAP server does not auto-expunge deleted messages - it is Make sure your IMAP server does not auto-expunge deleted messages - it is

Loading…
Cancel
Save