Change formatting of comments

This commit is contained in:
Matej Focko 2019-11-23 13:46:45 +01:00
parent 8e7648ce5a
commit 2d98660213

View file

@ -1,11 +1,16 @@
#!/usr/bin/env python3
import json
from commands.base import BaseCommand
from gitlab import get_mrs_for_branch, get_comments
class Comments(BaseCommand):
width = 5
@staticmethod
def sort_comments(comments):
result = {}
@ -32,7 +37,12 @@ class Comments(BaseCommand):
continue
if comment["type"] == "DiffNote":
print(f"""L{comment["position"]["new_line"]}: {comment["body"]}""")
body = comment["body"].replace(
"\n", "\n" + " " * (Comments.width + 2)
)
print(
f"""{f'L{comment["position"]["new_line"]}':>{Comments.width}}: {body}"""
)
else:
print(f"""[{comment["created_at"]}]\n{comment["body"]}""")
print()