mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-22 00:45:10 +00:00
fix(kv): keep copy log rows single-spaced
This commit is contained in:
@@ -6,6 +6,7 @@ from typing import Optional, Union
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
from rich.console import RenderableType
|
||||||
from rich.padding import Padding
|
from rich.padding import Padding
|
||||||
from rich.progress import (
|
from rich.progress import (
|
||||||
MofNCompleteColumn,
|
MofNCompleteColumn,
|
||||||
@@ -55,6 +56,13 @@ def process_service_keys(from_vault: Vault, service: str, log: logging.Logger) -
|
|||||||
return {kid: key for kid, key in content_keys if kid not in bad_keys}
|
return {kid: key for kid, key in content_keys if kid not in bad_keys}
|
||||||
|
|
||||||
|
|
||||||
|
class _PaddedProgress(Progress):
|
||||||
|
"""Progress bar with a blank line above it and a left indent matching log rows."""
|
||||||
|
|
||||||
|
def get_renderable(self) -> RenderableType:
|
||||||
|
return Padding(super().get_renderable(), (1, 0, 0, 5))
|
||||||
|
|
||||||
|
|
||||||
def add_keys_with_progress(vault: Vault, service: str, kid_keys: dict[str, str], log: logging.Logger) -> int:
|
def add_keys_with_progress(vault: Vault, service: str, kid_keys: dict[str, str], log: logging.Logger) -> int:
|
||||||
"""Add content keys to a vault in batches, with a progress bar of counts and time left."""
|
"""Add content keys to a vault in batches, with a progress bar of counts and time left."""
|
||||||
|
|
||||||
@@ -65,8 +73,7 @@ def add_keys_with_progress(vault: Vault, service: str, kid_keys: dict[str, str],
|
|||||||
|
|
||||||
kids = list(kid_keys)
|
kids = list(kid_keys)
|
||||||
added = 0
|
added = 0
|
||||||
console.print()
|
with _PaddedProgress(
|
||||||
with Progress(
|
|
||||||
SpinnerColumn(finished_text=""),
|
SpinnerColumn(finished_text=""),
|
||||||
TextColumn("[bold]{task.description}"),
|
TextColumn("[bold]{task.description}"),
|
||||||
GradientPulseBarColumn(),
|
GradientPulseBarColumn(),
|
||||||
|
|||||||
Reference in New Issue
Block a user