From 4240f5602b1ad895b0bdc7b74cbf81556db07272 Mon Sep 17 00:00:00 2001 From: Urvashi Mohnani Date: Tue, 14 Nov 2023 13:01:57 -0500 Subject: [PATCH] Update pull progress bar colour The Downloading bar is now in the default terminal text color and is bolded for better visibility. Bars will switch to green when completed. Signed-off-by: Urvashi Mohnani --- podman/domain/images_manager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/podman/domain/images_manager.py b/podman/domain/images_manager.py index fb7e773b..17c15b9f 100644 --- a/podman/domain/images_manager.py +++ b/podman/domain/images_manager.py @@ -6,7 +6,7 @@ import urllib.parse from typing import Any, Dict, Generator, Iterator, List, Mapping, Optional, Union import requests -from rich.progress import Progress +from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn, TimeRemainingColumn from podman import api from podman.api import Literal @@ -323,7 +323,13 @@ def pull( if progress_bar: tasks = {} print("Pulling", params["reference"]) - with Progress() as progress: + progress = Progress( + TextColumn("[progress.description]{task.description}"), + BarColumn(complete_style="default", finished_style="green"), + TaskProgressColumn(), + TimeRemainingColumn(), + ) + with progress: for line in response.iter_lines(): decoded_line = json.loads(line.decode('utf-8')) self.__show_progress_bar(decoded_line, progress, tasks) @@ -350,7 +356,7 @@ def __show_progress_bar(self, line, progress, tasks): description = f'[green][Download complete {line["id"]}]' completed = True elif line['status'] == 'Downloading': - description = f'[red][Downloading {line["id"]}]' + description = f'[bold][Downloading {line["id"]}]' else: # skip other statuses return