From e17645a8f34c0a4052ee5a582fdc8cbdba84ea5a Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 13 May 2024 22:59:57 +0200 Subject: [PATCH] chore(notify): use CR to make stderr less noisy --- shiftregister/feedback/management/commands/notify.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shiftregister/feedback/management/commands/notify.py b/shiftregister/feedback/management/commands/notify.py index 3080fd3..845ed81 100644 --- a/shiftregister/feedback/management/commands/notify.py +++ b/shiftregister/feedback/management/commands/notify.py @@ -95,8 +95,6 @@ class Command(BaseCommand): return - self.stderr.write() - all_messages = set(messages) sent_messages = set() error = None @@ -104,16 +102,16 @@ class Command(BaseCommand): for message in send(all_messages): sent_messages.add(message) - self.stderr.write() self.stderr.write( self.style.SUCCESS( f"\r{str(len(sent_messages)).rjust(len(str(len(all_messages))))} / {len(all_messages)}" - ) + ), + ending="", ) - self.stderr.write() except Exception as e: error = e + self.stderr.write() self.stderr.write( self.style.WARNING(f"sent {len(sent_messages)} out of {len(all_messages)}") )