From 0dc92bf64305073eac3aa60175e7e436b1efaf8f Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 8 Jun 2020 17:58:18 +0200 Subject: [PATCH] Update formatting of diff notes (closes #14) --- commands/comments.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/comments.py b/commands/comments.py index 67c1aa3..6596cd4 100644 --- a/commands/comments.py +++ b/commands/comments.py @@ -51,17 +51,19 @@ class Comments(BaseCommand): for file_path in comments[author]: if file_path is not None: - print(f"# `{file_path.split('/')[-1]}`") + filename = file_path.split('/')[-1] + print(f"\n`{filename}`\n{'-'*(len(filename) + 2)}") for comment in comments[author][file_path]: if comment["system"]: continue if comment["type"] == "DiffNote": body = comment["body"].replace( - "\n", "\n" + " " * (Comments.width + 2) + "\n", "\n" + " " * (len(str(comment["position"]["new_line"])) + 5) ) + print( - f"""{f'L{comment["position"]["new_line"]}':>{Comments.width}}: {body}""" + f"""- L{comment["position"]["new_line"]}: {body}""" ) else: print(f"""[{comment["created_at"]}]\n{comment["body"]}""")