watch: Add no linewrap option

For long lines from a process, watch would wrap them around to the
next. While this default option has it uses, sometimes you want to
just cut those long lines down.

watch has a -w flag which will truncate the lines to the number
of columns. A few simple lines to do this new trick.

I think I caught all the ANSI state correctly but there might be
a chance it bleeds to the next row.

References:
 procps-ng/procps#182
This commit is contained in:
Craig Small
2020-10-19 22:03:44 +11:00
parent d10c8fccc9
commit d748966e39
3 changed files with 34 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
.TH WATCH 1 "2020-06-04" "procps-ng" "User Commands"
.TH WATCH 1 "2020-10-19" "procps-ng" "User Commands"
.SH NAME
watch \- execute a program periodically, showing output fullscreen
.SH SYNOPSIS
@@ -64,6 +64,9 @@ instead of
.B sh \-c
which reduces the need to use extra quoting to get the desired effect.
.TP
\fB\-w\fR, \fB\-\-no\-linewrap\fR
Turn off line wrapping. Long lines will be truncated instead of wrapped to the next line.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help text and exit.
.TP