From 9aef419c4c960df03eb5ecd1f40eb4c081966d4e Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Fri, 4 Oct 2024 19:59:21 +0100 Subject: [PATCH] Surround the "--average-rate" average rate with brackets rather than square brackets, to differentiate it from the "--rate" current rate. --- docs/NEWS.md | 1 + docs/pv.1 | 4 +++- docs/pv.1.md | 8 +++++--- src/pv/display.c | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/NEWS.md b/docs/NEWS.md index c26da0b..fc75c4f 100644 --- a/docs/NEWS.md +++ b/docs/NEWS.md @@ -5,6 +5,7 @@ * i18n: complete set of German translations supplied by Hartmut Goebel ([#98](https://codeberg.org/a-j-wood/pv/pulls/98)) * fix: resume stopped pipelines when running in the background (part of [#56](https://codeberg.org/a-j-wood/pv/issues/56)) * fix: prefix completion time ("`--fineta`") with *FIN* rather than *ETA* ([#43](https://codeberg.org/a-j-wood/pv/issues/43)) + * fix: surround average rate ("`--average-rate`") with brackets rather than square brackets * fix: correct a memory leak in "`--watchfd PID`" * fix: write UTC timestamps in debugging mode to avoid lockups in signal handlers * cleanup: removed TODO.md, since it's just an outdated copy of the issue tracker diff --git a/docs/pv.1 b/docs/pv.1 index 91cc3ad..f49bc0b 100644 --- a/docs/pv.1 +++ b/docs/pv.1 @@ -141,12 +141,13 @@ this option will have no effect if the total data size cannot be determined. .TP .B \-r, \-\-rate Turn the rate counter on. This will display the current rate of data -transfer. +transfer. The rate is shown in square brackets []. .TP .B \-a, \-\-average\-rate Turn the average rate counter on. This will display the current average rate of data transfer (default: last 30s, see .BR \-m ). +The average rate is shown in brackets (). .TP .B \-b, \-\-bytes Turn the total byte counter on. This will display the total amount of @@ -169,6 +170,7 @@ in the .B FORMATTING section below. Implies .BR \-C . +The transfer buffer percentage is shown in curly brackets {}. .TP .BI \-A\ NUM \fR,\ \fB\-\-last\-written\ NUM Show the last diff --git a/docs/pv.1.md b/docs/pv.1.md index 8febc47..c5f8a58 100644 --- a/docs/pv.1.md +++ b/docs/pv.1.md @@ -106,12 +106,13 @@ display types that are explicitly switched on will be shown. **-r, \--rate** : Turn the rate counter on. This will display the current rate of data - transfer. + transfer. The rate is shown in square brackets \[\]. **-a, \--average-rate** : Turn the average rate counter on. This will display the current - average rate of data transfer (default: last 30s, see **-m**). + average rate of data transfer (default: last 30s, see **-m**). The + average rate is shown in brackets (). **-b, \--bytes** @@ -133,7 +134,8 @@ display types that are explicitly switched on will be shown. : Turn on the transfer buffer percentage display. This will show the percentage of the transfer buffer in use - but see the caveat under - **%T** in the **FORMATTING** section below. Implies **-C**. + **%T** in the **FORMATTING** section below. Implies **-C**. The + transfer buffer percentage is shown in curly brackets {}. **-A NUM, \--last-written NUM** diff --git a/src/pv/display.c b/src/pv/display.c index 35b4a3e..0dbbe2a 100644 --- a/src/pv/display.c +++ b/src/pv/display.c @@ -848,11 +848,11 @@ bool pv_format(pvstate_t state, bool final) if (state->control.bits && !state->control.linemode) { /* bits per second */ pv__sizestr(component_content, component_buf_size, - "[%s]", 8 * state->calc.average_rate, "", _("b/s"), count_type); + "(%s)", 8 * state->calc.average_rate, "", _("b/s"), count_type); } else { /* bytes or lines per second */ pv__sizestr(component_content, - component_buf_size, "[%s]", state->calc.average_rate, _("/s"), _("B/s"), + component_buf_size, "(%s)", state->calc.average_rate, _("/s"), _("B/s"), count_type); } /*@+mustfreefresh @ *//* splint: see above. */