Give "--monitor" a parameter to set which side(s) of the command to monitor (#67).
This commit is contained in:
@@ -14,7 +14,7 @@ pv \- monitor and manage the progress of data through a pipe
|
||||
.PP
|
||||
\fBpv\fR \fB\-Q\fR|\fB\-\-query\fR \fIPID\fR [\fIOPTION\fR]...
|
||||
.PP
|
||||
\fBpv\fR [\fIOPTION\fR]... \fB\-M\fR|\fB\-\-monitor\fR \-\- \fICOMMAND\fR [\fIARGS\fR]...
|
||||
\fBpv\fR [\fIOPTION\fR]... \fB\-M\fR|\fB\-\-monitor\fR \fISIDE\fR \-\- \fICOMMAND\fR [\fIARGS\fR]...
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
Show the progress of data through a pipeline by giving information such as
|
||||
@@ -415,19 +415,31 @@ they match those of that process - such as
|
||||
\*(lq\fB\-\-average\-rate\-window\fR\*(rq.
|
||||
Data transfer modifiers will have no effect.
|
||||
.TP
|
||||
.B \-M, \-\-monitor
|
||||
.BR \-M " \fISIDE\fR, " \-\-monitor " \fISIDE\fR"
|
||||
Run the command specified by the remaining arguments, and monitor its
|
||||
standard input and standard output.
|
||||
standard input, its standard output, or both, depending on whether
|
||||
\fISIDE\fR is \*(lq\fBin\fR\*(rq, \*(lq\fBout\fR\*(rq, or
|
||||
\*(lq\fBboth\fR\*(rq.
|
||||
Use \*(lq\fB\-\-\fR\*(rq after all of the \fBpv\fR options to keep the
|
||||
monitored command's options separate.
|
||||
.IP
|
||||
For example, \*(lq\fBpv\~\-\-cursor\~\-\-monitor\~\-\-\~gzip\~\-9\fR\*(rq is
|
||||
With a \fISIDE\fR of \*(lq\fBboth\fR\*(rq, two progress bars will be shown.
|
||||
All of \fBpv\fR's display switches, output modifiers, and data transfer
|
||||
modifiers will apply to both sides.
|
||||
The \*(lq\fB\-\-format\fR\*(rq and \*(lq\fB\-\-name\fR\*(rq options may be
|
||||
specified twice, in which case the first one applies to the input side and
|
||||
the second applies to the output side.
|
||||
.IP
|
||||
For example,
|
||||
\*(lq\fBpv\~\-\-cursor\~\-\-monitor\~both\~\-\-\~gzip\~\-9\fR\*(rq is
|
||||
equivalent to
|
||||
\*(lq\fBpv\~\-\-cursor\~|\~gzip\~\-9\~|\~pv\~\-\-cursor\fR\*(rq, except that
|
||||
the latter can't show the input:output ratio.
|
||||
.\"TODO: choice of displaying two progress bars (in + out) or only one
|
||||
.IP
|
||||
The values \*(lq\fB0\fR\*(rq, \*(lq\fB1\fR\*(rq, and \*(lq\fB2\fR\*(rq may
|
||||
be used as synonyms for \*(lq\fBin\fR\*(rq, \*(lq\fBout\fR\*(rq, and
|
||||
\*(lq\fBboth\fR\*(rq.
|
||||
.\"TODO: formatting option for input:output ratio
|
||||
.\"TODO: a way to specify the name of each bar, if there are two
|
||||
.\"
|
||||
.SS "Other options"
|
||||
.TP
|
||||
|
||||
+2
-2
@@ -372,8 +372,8 @@ void display_help(void)
|
||||
N_("show progress of process PID"),
|
||||
{ 0, 0, 0, 0} },
|
||||
#endif /* PV_REMOTE_CONTROL */
|
||||
{ "-M", "--monitor", NULL,
|
||||
N_("monitor the input and output of a command"),
|
||||
{ "-M", "--monitor", N_("SIDE"),
|
||||
N_("run a command and monitor its standard input, output, or both"),
|
||||
{ 0, 0, 0, 0} },
|
||||
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
|
||||
{ "-P", "--pidfile", N_("FILE"),
|
||||
|
||||
+6
-4
@@ -680,7 +680,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
{ "watchfd", 1, NULL, (int) 'd' },
|
||||
{ "output", 1, NULL, (int) 'o' },
|
||||
{ "average-rate-window", 1, NULL, (int) 'm' },
|
||||
{ "monitor", 0, NULL, (int) 'M' },
|
||||
{ "monitor", 1, NULL, (int) 'M' },
|
||||
#ifdef ENABLE_DEBUGGING
|
||||
{ "debug", 1, NULL, (int) '!' },
|
||||
#endif /* ENABLE_DEBUGGING */
|
||||
@@ -689,7 +689,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
/*@+nullassign@ */
|
||||
int option_index = 0;
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:u:F:x:L:B:CEZ:SYKOXU:R:Q:P:d:m:o:M"
|
||||
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:u:F:x:L:B:CEZ:SYKOXU:R:Q:P:d:m:o:M:"
|
||||
#ifdef ENABLE_DEBUGGING
|
||||
"!:"
|
||||
#endif
|
||||
@@ -996,6 +996,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
opts->height_set_manually = opts->height == 0 ? false : true;
|
||||
break;
|
||||
case 'N':
|
||||
/* TODO: preserve previous name for use with "-M both" */
|
||||
opts->name = pv_strdup(optarg);
|
||||
if (NULL == opts->name) {
|
||||
fprintf(stderr, "%s: -N: %s\n", opts->program_name, strerror(errno));
|
||||
@@ -1070,6 +1071,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
/* TODO: preserve previous format for use with "-M both" */
|
||||
opts->format = pv_strdup(optarg);
|
||||
if (NULL == opts->format) {
|
||||
fprintf(stderr, "%s: -F: %s\n", opts->program_name, strerror(errno));
|
||||
@@ -1105,6 +1107,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
break;
|
||||
case 'M':
|
||||
opts->action = PV_ACTION_MONITOR;
|
||||
/* TODO: parse optarg to set the side */
|
||||
break;
|
||||
#ifdef ENABLE_DEBUGGING
|
||||
case '!':
|
||||
@@ -1259,8 +1262,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
*/
|
||||
if ((PV_ACTION_MONITOR == opts->action) && (optind >= (int) argc)) {
|
||||
/*@-mustfreefresh@ *//* see above */
|
||||
fprintf(stderr, "%s: -M: %s\n", opts->program_name,
|
||||
_("a command to run must be specified"));
|
||||
fprintf(stderr, "%s: -M: %s\n", opts->program_name, _("a command to run must be specified"));
|
||||
opts_free(opts);
|
||||
return NULL;
|
||||
/*@+mustfreefresh@ */
|
||||
|
||||
Reference in New Issue
Block a user