Align plugin names on diagnostic

This commit is contained in:
MinchinWeb 2021-10-11 14:06:38 -06:00
parent 84cb67204e
commit 159ef25248

View file

@ -11,6 +11,7 @@ run.
Also, please note that all (non-builtin) imports should be scoped to each function to Also, please note that all (non-builtin) imports should be scoped to each function to
avoid any possible overhead for these standalone commands. avoid any possible overhead for these standalone commands.
""" """
from itertools import chain
import platform import platform
import sys import sys
@ -29,20 +30,23 @@ def preconfig_diagnostic(_):
f"Python: {sys.version}\n" f"Python: {sys.version}\n"
f"OS: {platform.system()} {platform.release()}" f"OS: {platform.system()} {platform.release()}"
) )
plugin_name_length = max(
[len(str(x)) for x in chain(IMPORT_FORMATS, EXPORT_FORMATS)]
)
print() print()
print("Active Plugins:") print("Active Plugins:")
print(" Importers:") print(" Importers:")
for importer in IMPORT_FORMATS: for importer in IMPORT_FORMATS:
importer_class = get_importer(importer) importer_class = get_importer(importer)
print( print(f" {importer:{plugin_name_length}} : ", end="")
f" {importer} : {importer_class.version} from", print(f"{importer_class.version} from ", end="")
f"{importer_class().class_path()}", print(f"{importer_class().class_path()}")
)
print(" Exporters:") print(" Exporters:")
for exporter in EXPORT_FORMATS: for exporter in EXPORT_FORMATS:
exporter_class = get_exporter(exporter) exporter_class = get_exporter(exporter)
# print(f" {exporter} : {exporter_class.version} from {exporter_class().class_path()}") print(f" {exporter:{plugin_name_length}} : ", end="")
print(f" {exporter} : ", end="")
print(f"{exporter_class.version} from ", end="") print(f"{exporter_class.version} from ", end="")
print(f"{exporter_class().class_path()}") print(f"{exporter_class().class_path()}")