f
This commit is contained in:
@@ -92,11 +92,21 @@ class ProgressBar:
|
||||
if self.quiet:
|
||||
return
|
||||
|
||||
term_width = shutil.get_terminal_size((80, 20)).columns
|
||||
percent = int(100 * (self.current / self.total))
|
||||
filled = int(self.bar_width * self.current // self.total)
|
||||
bar = "█" * filled + "░" * (self.bar_width - filled)
|
||||
|
||||
sys.stdout.write(f"\r [{bar}] {percent:3}% | {step_name.ljust(30)}")
|
||||
# Overwrite previous bar/label by moving up if not the first step
|
||||
if self.current > 1:
|
||||
sys.stdout.write("\033[2A")
|
||||
|
||||
bar_line = f"[{bar}]"
|
||||
info_line = f"{percent}% | {step_name}"
|
||||
|
||||
sys.stdout.write(f"\r{bar_line.center(term_width)}\n")
|
||||
# Clear line and print info line centered
|
||||
sys.stdout.write(f"\r\033[K{info_line.center(term_width)}\r")
|
||||
sys.stdout.flush()
|
||||
|
||||
if self.current == self.total:
|
||||
@@ -685,8 +695,6 @@ def main() -> int:
|
||||
os.system("cls" if os.name == "nt" else "clear")
|
||||
# Center the logo
|
||||
logo_lines = LOGO.strip().splitlines()
|
||||
# Filter out the ruler lines if they are still there
|
||||
logo_lines = [line for line in logo_lines if not any(c.isdigit() for c in line.strip())]
|
||||
|
||||
print("\n" * 2)
|
||||
for line in logo_lines:
|
||||
@@ -925,8 +933,6 @@ def main() -> int:
|
||||
os.system('cls' if os.name == 'nt' else 'clear')
|
||||
term_width = shutil.get_terminal_size((80, 20)).columns
|
||||
logo_lines = LOGO.strip().splitlines()
|
||||
# Filter out the ruler lines
|
||||
logo_lines = [line for line in logo_lines if not any(c.isdigit() for c in line.strip())]
|
||||
print("\n" * 2)
|
||||
for line in logo_lines:
|
||||
print(line.center(term_width))
|
||||
|
||||
Reference in New Issue
Block a user