From 30f8d3f1917cefd10f33564a907aeb1027cd43fe Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 11 Dec 2020 16:21:52 +0200 Subject: [PATCH] show python implementation name and flip verison output order for easier reading when wrapped on small screens --- archivebox/logging_util.py | 27 +++++++++++++++++---------- archivebox/main.py | 3 ++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/archivebox/logging_util.py b/archivebox/logging_util.py index 7bce3313..f2b86735 100644 --- a/archivebox/logging_util.py +++ b/archivebox/logging_util.py @@ -19,6 +19,7 @@ if TYPE_CHECKING: from .util import enforce_types from .config import ( ConfigDict, + OUTPUT_DIR, PYTHON_ENCODING, ANSI, IS_TTY, @@ -514,19 +515,24 @@ def printable_folder_status(name: str, folder: Dict) -> str: else: num_files = 'missing' - if ' ' in str(folder['path']): - folder['path'] = f'"{folder["path"]}"' + path = str(folder['path']).replace(str(OUTPUT_DIR), '.') if folder['path'] else '' + if path and ' ' in path: + path = f'"{path}"' + + # if path is just a plain dot, replace it back with the full path for clarity + if path == '.': + path = str(OUTPUT_DIR) return ' '.join(( ANSI[color], symbol, ANSI['reset'], - name.ljust(22), - (str(folder["path"]) or '').ljust(76), + name.ljust(21), num_files.ljust(14), ANSI[color], - note, + note.ljust(8), ANSI['reset'], + path.ljust(76), )) @@ -546,17 +552,18 @@ def printable_dependency_version(name: str, dependency: Dict) -> str: else: color, symbol, note, version = 'lightyellow', '-', 'disabled', '-' - if ' ' in (dependency["path"] or ''): - dependency["path"] = f'"{dependency["path"]}"' + path = str(dependency["path"]).replace(str(OUTPUT_DIR), '.') if dependency["path"] else '' + if path and ' ' in path: + path = f'"{path}"' return ' '.join(( ANSI[color], symbol, ANSI['reset'], - name.ljust(22), - (dependency["path"] or '').ljust(76), + name.ljust(21), version.ljust(14), ANSI[color], - note, + note.ljust(8), ANSI['reset'], + path.ljust(76), )) diff --git a/archivebox/main.py b/archivebox/main.py index 97c13c4e..6476fd7d 100644 --- a/archivebox/main.py +++ b/archivebox/main.py @@ -69,6 +69,7 @@ from .config import ( ANSI, IS_TTY, IN_DOCKER, + PYTHON_VERSION, USER, ARCHIVEBOX_BINARY, ONLY_NEW, @@ -218,7 +219,7 @@ def version(quiet: bool=False, else: print('ArchiveBox v{}'.format(VERSION)) p = platform.uname() - print(p.system, platform.platform(), p.machine) + print(sys.implementation.name.title(), p.system, platform.platform(), p.machine, f'(in Docker)' if IN_DOCKER else f'(not in Docker)') print() print('{white}[i] Dependency versions:{reset}'.format(**ANSI))