On Sat, Jan 28, 2023 at 1:22 AM Michael Homscheidt wrote:
> I use rsync with the option --out-format '%o %n? but want to have the
> contents of the mesages to be overwritten.
You can't make rsync do that directly, but you can filter the output. For
instance, the following python3 script runs rsync with an --out-format that
starts with "<>" and filters the combined stdout + stderr
output, putting
repeated "<>" lines over the top of each other (using ANSII
reverse-index &
clear-to-EOL escape sequences). It also allows error/info lines to remain
visible: they do not overwrite the prior merged line and a new merged line
starts below it. If a line is too long to fit on a single terminal line
then there will be some downward movement, but that could be improved
should you desire to do so.
Name this script something like "solo-rsync":
#!/usr/bin/python3
import sys, subprocess
rsync subprocess.Popen(
['rsync', '--outbuf=line',
'--out-format=<>%o %n',
*sys.argv[1:]],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
encoding='UTF-8')
folding = False
for line in rsync.stdout:
if line.startswith('<>'):
if folding:
print("\033[A" + line[2:].rstrip("\n") +
"\033[K")
else:
print(line[2:], end='')
folding = True
else:
print(line, end='')
folding = False
sys.stdout.flush()
..wayne..
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.samba.org/pipermail/rsync/attachments/20230128/d3a98c22/attachment.htm>