Re: out-format in one line

2023-01-28 Thread Wayne Davison via rsync
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..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


out-format in one line

2023-01-28 Thread Michael Homscheidt via rsync
Hello,

I use rsync with the option --out-format '%o %n‘ but want to have the contents 
of the mesages to be overwritten. This means that the actual message while 
synchronisation shall overwritte the previous one. Therefore i wanted to add a 
carriage return ‚\r‘ at the end of the —out-format string but this did not 
work. How can I do this?

Regards
Michael




-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html