New option "--stats", to show a line of statistics about the transfer once it has ended (issue #49).

This commit is contained in:
Andrew Wood
2024-10-04 15:12:22 +01:00
parent fe4cc4b01d
commit 9bd5a518ea
19 changed files with 473 additions and 264 deletions
+3
View File
@@ -319,6 +319,9 @@ void display_help(void)
{ "-F", "--format", N_("FORMAT"),
N_("set output format to FORMAT"),
{ 0, 0, 0, 0} },
{ "-v", "--stats", NULL,
N_("output transfer statistics at the end"),
{ 0, 0, 0, 0} },
{ "-n", "--numeric", NULL,
N_("output percentages, not visual information"),
{ 0, 0, 0, 0} },
+1
View File
@@ -306,6 +306,7 @@ int main(int argc, char **argv)
pv_state_no_display_set(state, opts->no_display);
pv_state_force_set(state, opts->force);
pv_state_cursor_set(state, opts->cursor);
pv_state_show_stats_set(state, opts->show_stats);
pv_state_numeric_set(state, opts->numeric);
pv_state_wait_set(state, opts->wait);
pv_state_delay_start_set(state, opts->delay_start);
+5 -1
View File
@@ -290,6 +290,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
{ "height", 1, NULL, (int) 'H' },
{ "name", 1, NULL, (int) 'N' },
{ "format", 1, NULL, (int) 'F' },
{ "stats", 0, NULL, (int) 'v' },
{ "rate-limit", 1, NULL, (int) 'L' },
{ "buffer-size", 1, NULL, (int) 'B' },
{ "no-splice", 0, NULL, (int) 'C' },
@@ -312,7 +313,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
/*@+nullassign@ */
int option_index = 0;
#endif /* HAVE_GETOPT_LONG */
char *short_options = "hVpteIrab8kTA:fnqcWD:s:l0i:w:H:N:F:L:B:CEZ:SYKXR:P:d:m:o:"
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:l0i:w:H:N:F:L:B:CEZ:SYKXR:P:d:m:o:"
#ifdef ENABLE_DEBUGGING
"!:"
#endif
@@ -512,6 +513,9 @@ opts_t opts_parse(unsigned int argc, char **argv)
case 'f':
opts->force = true;
break;
case 'v':
opts->show_stats = true;
break;
case 'n':
opts->numeric = true;
numopts++;