Selaa lähdekoodia

show python implementation name and flip verison output order for easier reading when wrapped on small screens

Nick Sweeting 5 vuotta sitten
vanhempi
sitoutus
30f8d3f191
2 muutettua tiedostoa jossa 19 lisäystä ja 11 poistoa
  1. 17 10
      archivebox/logging_util.py
  2. 2 1
      archivebox/main.py

+ 17 - 10
archivebox/logging_util.py

@@ -19,6 +19,7 @@ if TYPE_CHECKING:
 from .util import enforce_types
 from .util import enforce_types
 from .config import (
 from .config import (
     ConfigDict,
     ConfigDict,
+    OUTPUT_DIR,
     PYTHON_ENCODING,
     PYTHON_ENCODING,
     ANSI,
     ANSI,
     IS_TTY,
     IS_TTY,
@@ -514,19 +515,24 @@ def printable_folder_status(name: str, folder: Dict) -> str:
         else:
         else:
             num_files = 'missing'
             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((
     return ' '.join((
         ANSI[color],
         ANSI[color],
         symbol,
         symbol,
         ANSI['reset'],
         ANSI['reset'],
-        name.ljust(22),
-        (str(folder["path"]) or '').ljust(76),
+        name.ljust(21),
         num_files.ljust(14),
         num_files.ljust(14),
         ANSI[color],
         ANSI[color],
-        note,
+        note.ljust(8),
         ANSI['reset'],
         ANSI['reset'],
+        path.ljust(76),
     ))
     ))
 
 
 
 
@@ -546,17 +552,18 @@ def printable_dependency_version(name: str, dependency: Dict) -> str:
     else:
     else:
         color, symbol, note, version = 'lightyellow', '-', 'disabled', '-'
         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((
     return ' '.join((
         ANSI[color],
         ANSI[color],
         symbol,
         symbol,
         ANSI['reset'],
         ANSI['reset'],
-        name.ljust(22),
-        (dependency["path"] or '').ljust(76),
+        name.ljust(21),
         version.ljust(14),
         version.ljust(14),
         ANSI[color],
         ANSI[color],
-        note,
+        note.ljust(8),
         ANSI['reset'],
         ANSI['reset'],
+        path.ljust(76),
     ))
     ))

+ 2 - 1
archivebox/main.py

@@ -69,6 +69,7 @@ from .config import (
     ANSI,
     ANSI,
     IS_TTY,
     IS_TTY,
     IN_DOCKER,
     IN_DOCKER,
+    PYTHON_VERSION,
     USER,
     USER,
     ARCHIVEBOX_BINARY,
     ARCHIVEBOX_BINARY,
     ONLY_NEW,
     ONLY_NEW,
@@ -218,7 +219,7 @@ def version(quiet: bool=False,
     else:
     else:
         print('ArchiveBox v{}'.format(VERSION))
         print('ArchiveBox v{}'.format(VERSION))
         p = platform.uname()
         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()
 
 
         print('{white}[i] Dependency versions:{reset}'.format(**ANSI))
         print('{white}[i] Dependency versions:{reset}'.format(**ANSI))