Update formatting of diff notes (closes #14)

This commit is contained in:
Matej Focko 2020-06-08 17:58:18 +02:00
parent 7f4a439bbc
commit 0dc92bf643
Signed by: mfocko
GPG key ID: 299B916A55682021

View file

@ -51,17 +51,19 @@ class Comments(BaseCommand):
for file_path in comments[author]: for file_path in comments[author]:
if file_path is not None: 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]: for comment in comments[author][file_path]:
if comment["system"]: if comment["system"]:
continue continue
if comment["type"] == "DiffNote": if comment["type"] == "DiffNote":
body = comment["body"].replace( body = comment["body"].replace(
"\n", "\n" + " " * (Comments.width + 2) "\n", "\n" + " " * (len(str(comment["position"]["new_line"])) + 5)
) )
print( print(
f"""{f'L{comment["position"]["new_line"]}':>{Comments.width}}: {body}""" f"""- L{comment["position"]["new_line"]}: {body}"""
) )
else: else:
print(f"""[{comment["created_at"]}]\n{comment["body"]}""") print(f"""[{comment["created_at"]}]\n{comment["body"]}""")