Change formatting of comments
This commit is contained in:
parent
8e7648ce5a
commit
2d98660213
1 changed files with 11 additions and 1 deletions
|
@ -1,11 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
from commands.base import BaseCommand
|
from commands.base import BaseCommand
|
||||||
from gitlab import get_mrs_for_branch, get_comments
|
from gitlab import get_mrs_for_branch, get_comments
|
||||||
|
|
||||||
|
|
||||||
class Comments(BaseCommand):
|
class Comments(BaseCommand):
|
||||||
|
width = 5
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def sort_comments(comments):
|
def sort_comments(comments):
|
||||||
result = {}
|
result = {}
|
||||||
|
@ -32,7 +37,12 @@ class Comments(BaseCommand):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if comment["type"] == "DiffNote":
|
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:
|
else:
|
||||||
print(f"""[{comment["created_at"]}]\n{comment["body"]}""")
|
print(f"""[{comment["created_at"]}]\n{comment["body"]}""")
|
||||||
print()
|
print()
|
||||||
|
|
Reference in a new issue