From 1e15cfa42d3bc6ff6f850fe21be5507eb172b4f6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 9 Aug 2019 15:11:58 +0100 Subject: scripts/filter-active.py: Size left-hand column to fit all names Currently the issues without CVE IDs have long names that cause their rows to be misaligned. Calculate the left-hand column width based on the maximum issue name length. --- scripts/filter-active.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/filter-active.py b/scripts/filter-active.py index 08ba86c1..dd164ab0 100755 --- a/scripts/filter-active.py +++ b/scripts/filter-active.py @@ -87,19 +87,21 @@ if __name__ == '__main__': all_releases |= i.get_releases() list_releases = sorted(list(all_releases - exc_releases)) + name_width = max(len(i.name) for i in issues) + if len(list_releases) == 1: min_width = 0 max_width = 1000 else: min_width = 20 max_width = 20 - sys.stdout.write(" ") + sys.stdout.write(" " * (name_width + 1)) for release in list_releases: sys.stdout.write(" %-20.20s " % release) sys.stdout.write("\n") for i in issues: - sys.stdout.write("%17s:" % i.name) + sys.stdout.write("%*s:" % (name_width, i.name)) for release in list_releases: status = i.status(release) or "unknown" status_short = status.split(' ')[0] -- cgit v1.2.3