summaryrefslogtreecommitdiff
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
parent4d61440c07613661a569a76ba54d0c7d27de1efe (diff)
added horizontal wavey bars
-rw-r--r--src/util.py7
-rw-r--r--src/xi.py5
2 files changed, 9 insertions, 3 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)
diff --git a/src/xi.py b/src/xi.py
index 27d43c3..f0c473c 100644
--- a/src/xi.py
+++ b/src/xi.py
@@ -44,6 +44,7 @@ def print_stats(conf, opts):
distro = util.get_distro()["NAME"]
+ print(colors.LIGHT_CYAN + ("~"*w) + colors.RESET)
print(colors.LIGHT_CYAN + "xipkg", end="")
print(colors.CYAN + " on ", end="")
print(colors.LIGHT_CYAN + distro)
@@ -53,7 +54,9 @@ def print_stats(conf, opts):
for repo,count in pkg_count.items():
print(f"\t{colors.BLUE}{repo}: {colors.LIGHT_BLUE}{count}")
- print(colors.RESET)
+
+ w, h = util.get_area()
+ print(colors.LIGHT_CYAN + ("~"*w) + colors.RESET)
def main():