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 | 5e29180276ec0c254d824d55d93737fe6fd36e84 (patch) | |
tree | 347360fba3771c45bdeeba3a9dfa249ca64cdba0 /bin/lts-cve-triage.py | |
parent | e1ac2437bb00808b614d7bbc1c4c966765f890b5 (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'), )) |