From 8bf630199e39be8527bf0efb9d3eab9d515c065b Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Tue, 13 Aug 2019 09:38:05 +0200 Subject: [PATCH] Highlight headers --- jan-pona-mute.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jan-pona-mute.py b/jan-pona-mute.py index cc7b9b9..9802d72 100755 --- a/jan-pona-mute.py +++ b/jan-pona-mute.py @@ -60,6 +60,8 @@ class DiasporaClient(cmd.Cmd): prompt = "\x1b[38;5;255m" + "> " + "\x1b[0m" intro = "Welcome to Diaspora! Use the intro command for a quick introduction." + header_format = "\x1b[1;38;5;255m" + "%s" + "\x1b[0m" + username = None pod = None password = None @@ -193,6 +195,10 @@ select the corresponding item. Use the print command to see more. self.pager = pager print("Pager set: %s" % self.pager) + def header(self, line): + """Wrap line in header format.""" + return self.header_format % line + def do_notifications(self, line): """List notifications.""" if self.connection == None: @@ -200,7 +206,7 @@ select the corresponding item. Use the print command to see more. return self.notifications = diaspy.notifications.Notifications(self.connection).last() for n, notification in enumerate(self.notifications): - print("%2d. %s %s" % (n+1, notification.when(), notification)) + print(self.header("%2d. %s %s") % (n+1, notification.when(), notification)) print("Enter a number to select the notification.") ### The end! @@ -279,7 +285,7 @@ The index number must refer to the current list of notifications.""" for n, comment in enumerate(comments): print() - print("%2d. %s %s" % (n+1, comment.when(), comment.author())) + print(self.header("%2d. %s %s") % (n+1, comment.when(), comment.author())) print() self.show(comment) -- 2.25.1