From 159ef25248441c0e19ad227cb319830cc32870ce Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Mon, 11 Oct 2021 14:06:38 -0600 Subject: [PATCH] Align plugin names on diagnostic --- jrnl/commands.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/jrnl/commands.py b/jrnl/commands.py index a058f1be..8fd7da50 100644 --- a/jrnl/commands.py +++ b/jrnl/commands.py @@ -11,6 +11,7 @@ run. Also, please note that all (non-builtin) imports should be scoped to each function to avoid any possible overhead for these standalone commands. """ +from itertools import chain import platform import sys @@ -29,20 +30,23 @@ def preconfig_diagnostic(_): f"Python: {sys.version}\n" f"OS: {platform.system()} {platform.release()}" ) + + plugin_name_length = max( + [len(str(x)) for x in chain(IMPORT_FORMATS, EXPORT_FORMATS)] + ) + print() print("Active Plugins:") print(" Importers:") for importer in IMPORT_FORMATS: importer_class = get_importer(importer) - print( - f" {importer} : {importer_class.version} from", - f"{importer_class().class_path()}", - ) + print(f" {importer:{plugin_name_length}} : ", end="") + print(f"{importer_class.version} from ", end="") + print(f"{importer_class().class_path()}") print(" Exporters:") for exporter in EXPORT_FORMATS: exporter_class = get_exporter(exporter) - # print(f" {exporter} : {exporter_class.version} from {exporter_class().class_path()}") - print(f" {exporter} : ", end="") + print(f" {exporter:{plugin_name_length}} : ", end="") print(f"{exporter_class.version} from ", end="") print(f"{exporter_class().class_path()}")