From 77b06090f69264bcc93911664bea2810cd4571ba Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 24 Nov 2021 22:22:30 +0000 Subject: cleaned a few things up --- src/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/util.py') diff --git a/src/util.py b/src/util.py index 50efa7b..50b8ff8 100644 --- a/src/util.py +++ b/src/util.py @@ -33,6 +33,11 @@ def loading_bar(completed, total, text, print(color + info, end="\r") +def fill_line(text, color, end="\n"): + columns, rows = shutil.get_terminal_size((80, 20)) + spaces = columns - (len(text)) + print(color + text + "".join([" " for i in range(spaces)]), end=end) + def print_reset(text): print(colors.RESET + text) @@ -65,7 +70,7 @@ def curl_to_file(url, path, text=""): for chunk in ic: if text: divisor, unit = get_unit(length) - loading_bar(int(done/divisor), int(length/divisor), "Downloading " + text, unit=unit) + loading_bar(round(done/divisor, 2), round(length/divisor, 2), "Downloading " + text, unit=unit) f.write(chunk) done += c_size -- cgit v1.2.1