diff options
author | Sylvain Beucler <beuc@beuc.net> | 2019-07-02 11:08:20 +0200 |
---|---|---|
committer | Sylvain Beucler <beuc@beuc.net> | 2019-07-02 11:12:08 +0200 |
commit | 103e157f71dcf270f825cf2b6eb55c265dab7b01 (patch) | |
tree | 66b1fb038cedb681598fcbfafc93c9dd9cb07dc0 /bin/lts-cve-triage.py | |
parent | 2d797b3419c1802f5a7f6fb252223a37389d37bb (diff) |
lts-cve-triage: fix formatting with no-colors output
Diffstat (limited to 'bin/lts-cve-triage.py')
-rwxr-xr-x | bin/lts-cve-triage.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/lts-cve-triage.py b/bin/lts-cve-triage.py index 5562ce49fe..911ae32c0c 100755 --- a/bin/lts-cve-triage.py +++ b/bin/lts-cve-triage.py @@ -24,10 +24,12 @@ from unsupported_packages import UnsupportedPackages, LimitedSupportPackages def colored(x, *args, **kwargs): return x +colored_on = False try: if sys.stdout.isatty(): from termcolor import colored + colored_on = True except ImportError: print("Note: you can install python-termcolor for colored output") pass @@ -150,7 +152,10 @@ for key, desc in LIST_NAMES: continue print('\n{}:'.format(colored(desc, attrs=('bold',)))) for pkg in sorted(lists[key].keys()): - print('\n* {:<35s} {}'.format( + formatstring = '\n* {:<18s} {}' + if colored_on: + formatstring = '\n* {:<35s} {}' + print(formatstring.format( colored(pkg, 'red', attrs=('bold', 'underline')), colored('{}source-package/{}'.format(TRACKER_URL, pkg), 'blue'), )) |