summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-11-09 17:43:58 +0000
committerdavidovski <david@davidovski.xyz>2021-11-09 17:43:58 +0000
commit99bec9d9cd20adf0e446de8571a47ca70d4cba97 (patch)
treeab5aaae34184d2868ba3403910c8d65a8443654b /src
parenta4618ee489a1cc393e195d61e965bd41885e8f14 (diff)
changed colours a bit
Diffstat (limited to 'src')
-rw-r--r--src/util.py10
-rw-r--r--src/verbs/sync.py6
2 files changed, 6 insertions, 10 deletions
diff --git a/src/util.py b/src/util.py
index de05b08..3badca0 100644
--- a/src/util.py
+++ b/src/util.py
@@ -4,8 +4,11 @@ import colors
import time
import os
+DEFAULT_BAR_COLOR = colors.BLACK + colors.BG_CYAN
+DEFAULT_BAR_COLOR_RESET = colors.BG_BLACK + colors.CYAN
+
def loading_bar(completed, total, text,
- unit=""):
+ unit="", color=DEFAULT_BAR_COLOR, reset=DEFAULT_BAR_COLOR_RESET):
columns, rows = shutil.get_terminal_size((80, 20))
@@ -14,11 +17,10 @@ def loading_bar(completed, total, text,
spaces = columns - (len(count) + len(text))
info = text + "".join([" " for i in range(spaces)]) + count
-
reset_at = int((completed/total)*len(info)) if total > 0 else 0
- info = "".join([info[i] + (colors.RESET if i == reset_at else "") for i in range(len(info))])
+ info = "".join([info[i] + (reset if i == reset_at else "") for i in range(len(info))])
- print(colors.BLACK + colors.BG_GREEN + info, end="\r")
+ print(color + info, end="\r")
diff --git a/src/verbs/sync.py b/src/verbs/sync.py
index fa78112..8b6e5e3 100644
--- a/src/verbs/sync.py
+++ b/src/verbs/sync.py
@@ -84,9 +84,3 @@ def sync(args, options, config):
num_packages = len(validated)
util.loading_bar(num_packages, num_packages, f"Synced {repo}")
print(colors.RESET)
-
-
-
-
-
- print("Synced!")