diff options
author | davidovski <david@davidovski.xyz> | 2021-11-24 22:22:30 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2021-11-24 22:22:30 +0000 |
commit | 77b06090f69264bcc93911664bea2810cd4571ba (patch) | |
tree | 85f9b27f50de66fbcd9b47c01b8386f80aba769f /src/util.py | |
parent | 52f1d6e6a5b0e0faca2d397114e107900b01b97d (diff) |
cleaned a few things up
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 |