summaryrefslogtreecommitdiff
path: root/src/util.py
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-01-19 00:02:08 +0000
committerdavidovski <david@davidovski.xyz>2022-01-19 00:02:08 +0000
commitbe11529ff79011f370ce2969dfa145dac81fbee3 (patch)
treec6680b9e49bb3efa550354517c9758069d3d5bb4 /src/util.py
parent4d61440c07613661a569a76ba54d0c7d27de1efe (diff)
added horizontal wavey bars
Diffstat (limited to 'src/util.py')
-rw-r--r--src/util.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util.py b/src/util.py
index 5ce93a9..928cb03 100644
--- a/src/util.py
+++ b/src/util.py
@@ -28,10 +28,13 @@ def is_root():
return os.environ.get("SUDO_UID") or os.geteuid() == 0
+def get_area():
+ columns, rows = shutil.get_terminal_size((80, 20))
+
def loading_bar(completed, total, text,
unit="", color=DEFAULT_BAR_COLOR, reset=DEFAULT_BAR_COLOR_RESET):
- columns, rows = shutil.get_terminal_size((80, 20))
+ columns, rows = get_area()
count = f"[{completed}{unit}/{total}{unit}]"
@@ -44,7 +47,7 @@ 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))
+ columns, rows = get_area()
spaces = columns - (len(text))
print(color + text + "".join([" " for i in range(spaces)]), end=end)