diff options
Diffstat (limited to 'src/util.py')
-rw-r--r-- | src/util.py | 7 |
1 files changed, 6 insertions, 1 deletions
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 |