From 047c9f58d8e5026c57bf50c54978501b53caa9d6 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 31 May 2025 09:46:51 -0400 Subject: [PATCH] scripts: get_maintainers: improve display of areas table Improve layout and make it more readable. Signed-off-by: Anas Nashif --- scripts/get_maintainer.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/get_maintainer.py b/scripts/get_maintainer.py index fdc9cada4f6..8bb38358b1a 100755 --- a/scripts/get_maintainer.py +++ b/scripts/get_maintainer.py @@ -30,6 +30,7 @@ import re import shlex import subprocess import sys +from tabulate import tabulate from yaml import load, YAMLError try: @@ -281,12 +282,36 @@ class Maintainers: def _areas_cmd(self, args): # 'areas' subcommand implementation + def multiline(items): + # Each item on its own line, empty string if none + return "\n".join(items) if items else "" + + table = [] for area in self.areas.values(): + maintainers = multiline(area.maintainers) + collaborators = multiline(area.collaborators) if args.maintainer: if args.maintainer in area.maintainers: - print("{:25}\t{}".format(area.name, ",".join(area.maintainers))) + table.append([ + area.name, + maintainers, + collaborators + ]) else: - print("{:25}\t{}".format(area.name, ",".join(area.maintainers))) + table.append([ + area.name, + maintainers, + collaborators + ]) + if table: + # Use plain tablefmt for better multi-line cell support + print(tabulate( + table, + headers=["Area", "Maintainers", "Collaborators"], + tablefmt="grid", + stralign="left", + disable_numparse=True + )) def _count_cmd(self, args): # 'count' subcommand implementation