diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-08-09 15:11:58 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-08-09 15:14:47 +0100 |
commit | 1e15cfa42d3bc6ff6f850fe21be5507eb172b4f6 (patch) | |
tree | 54147d45569499b7eb9dda51ed692b321ec0509d /scripts | |
parent | f34fe67ec7c3de1376295de7ea9819d6e18bed34 (diff) |
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.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/filter-active.py | 6 |
1 files changed, 4 insertions, 2 deletions
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] |