summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-10-10 04:17:41 +0200
committerAlejandro Colomar <alx@kernel.org>2023-10-10 04:17:56 +0200
commit15370a64924b1efc189ae5b77cb0cc811e173ef4 (patch)
tree53c65aade2ce605919134bd5bbc9c3cf7848ae66
parent06d8ef2478bd38465e6d8084844793b5ad46c17b (diff)
bin/ovr, share/man/man1/ovr.1: --no-alt: Add option to not use the alternate screen
In some cases, it might be simpler to use normal stdout. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-xbin/ovr17
-rw-r--r--share/man/man1/ovr.18
2 files changed, 24 insertions, 1 deletions
diff --git a/bin/ovr b/bin/ovr
index e04357c..a930710 100755
--- a/bin/ovr
+++ b/bin/ovr
@@ -26,7 +26,15 @@ ovr_alt()
}
+ovr_noalt()
+{
+ sed -e "s/^\(.\{,$(tput cols)\}\).*$/\1/" \
+ -e '2,$s/^/\x1B[1A\x1B[K/';
+}
+
+
n=1;
+alt=1
while test $# -ge 1; do
case "$1" in
-n | --lines)
@@ -36,6 +44,9 @@ while test $# -ge 1; do
n="$2";
shift;
;;
+ --no-alt)
+ alt=0;
+ ;;
-*)
err "$1: Unknown option.";
;;
@@ -46,4 +57,8 @@ while test $# -ge 1; do
shift;
done;
-ovr_alt;
+if test "$alt" = "1"; then
+ ovr_alt;
+else
+ ovr_noalt;
+fi;
diff --git a/share/man/man1/ovr.1 b/share/man/man1/ovr.1
index c9641f5..8aa7bb6 100644
--- a/share/man/man1/ovr.1
+++ b/share/man/man1/ovr.1
@@ -22,6 +22,14 @@ stdout lines overwrite each other
Set the number of lines that should remain in the terminal
after the program ends.
Default is 1.
+.TP
+.B \-\-no\-alt
+Don't use the alternate screen.
+Instead,
+use control escape sequences
+to overwrite previous lines in the terminal.
+.B \-n
+is ignored in this mode.
.
.
.SH Description