From f15287fd505a6d47ba4266c902d93ff65068fabe Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Fri, 14 Mar 2025 15:26:41 +0100 Subject: [PATCH] cli/supported_licenses: simplify the license list Remove the license reference, since it may not fit the terminal. Move the license name before the license id, in order to improve the user experience. Make the text width dynamic, in order to improve readability. --- src/reuse/cli/supported_licenses.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/reuse/cli/supported_licenses.py b/src/reuse/cli/supported_licenses.py index 65c8df96a..965559bb5 100644 --- a/src/reuse/cli/supported_licenses.py +++ b/src/reuse/cli/supported_licenses.py @@ -20,10 +20,15 @@ def supported_licenses() -> None: # pylint: disable=missing-function-docstring licenses = _load_license_list(_LICENSES)[1] + license_name_width = 0 for license_id, license_info in licenses.items(): license_name = license_info["name"] - license_reference = license_info["reference"] - click.echo( - f"{license_id: <40}\t{license_name: <80}\t" - f"{license_reference: <50}" - ) + + width = len(license_name) + if width > license_name_width: + license_name_width = width + + for license_id, license_info in licenses.items(): + license_name = license_info["name"] + + click.echo(f"{license_name: <{license_name_width}} {license_id}")