From d9967257606980d28338c7ae6a1fe0e849af5ef3 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Fri, 22 Mar 2019 16:13:59 +0100 Subject: [PATCH] more color --- test/sync_test.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/sync_test.py b/test/sync_test.py index 1f71b9a..2c07aa8 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -122,13 +122,23 @@ if __name__ == "__main__": import pEp import re from datetime import datetime - + try: + from termcolor import colored + except: + colored = lambda x, y: x + inbox = pathlib.Path("TestInbox") for p in reversed([ path for path in inbox.glob("*.eml") ]): with open(p, "rb") as f: + if p.name[:5] == "Phone": + color = "red" + elif p.name[:6] == "Laptop": + color = "green" + else: + color = None t = f.read(-1) msg = pEp.Message(t) - print("\n" + str(p)) + print("\n" + colored(str(p), color)) print(datetime.fromtimestamp(p.stat().st_mtime)) m = re.search("(.*)", msg.opt_fields["pEp.sync"]) print(m.group(1))