Skip to content

Commit 047c9f5

Browse files
nashifkartben
authored andcommitted
scripts: get_maintainers: improve display of areas table
Improve layout and make it more readable. Signed-off-by: Anas Nashif <[email protected]>
1 parent 3555c26 commit 047c9f5

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

scripts/get_maintainer.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import shlex
3131
import subprocess
3232
import sys
33+
from tabulate import tabulate
3334

3435
from yaml import load, YAMLError
3536
try:
@@ -281,12 +282,36 @@ def _commits_cmd(self, args):
281282

282283
def _areas_cmd(self, args):
283284
# 'areas' subcommand implementation
285+
def multiline(items):
286+
# Each item on its own line, empty string if none
287+
return "\n".join(items) if items else ""
288+
289+
table = []
284290
for area in self.areas.values():
291+
maintainers = multiline(area.maintainers)
292+
collaborators = multiline(area.collaborators)
285293
if args.maintainer:
286294
if args.maintainer in area.maintainers:
287-
print("{:25}\t{}".format(area.name, ",".join(area.maintainers)))
295+
table.append([
296+
area.name,
297+
maintainers,
298+
collaborators
299+
])
288300
else:
289-
print("{:25}\t{}".format(area.name, ",".join(area.maintainers)))
301+
table.append([
302+
area.name,
303+
maintainers,
304+
collaborators
305+
])
306+
if table:
307+
# Use plain tablefmt for better multi-line cell support
308+
print(tabulate(
309+
table,
310+
headers=["Area", "Maintainers", "Collaborators"],
311+
tablefmt="grid",
312+
stralign="left",
313+
disable_numparse=True
314+
))
290315

291316
def _count_cmd(self, args):
292317
# 'count' subcommand implementation

0 commit comments

Comments
 (0)