mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
feat: Use the Spinner instead of the inlined custom spinner
This commit is contained in:
parent
d0ffbf173b
commit
fd43cd401d
1 changed files with 4 additions and 9 deletions
|
@ -207,9 +207,7 @@ def run_install(cmd):
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
spinner = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
spinner = Spinner("Installing...")
|
||||||
last_update = time.time()
|
|
||||||
update_interval = 0.2 # 5 times per second
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
char = process.stdout.read(1)
|
char = process.stdout.read(1)
|
||||||
|
@ -217,17 +215,14 @@ def run_install(cmd):
|
||||||
break
|
break
|
||||||
|
|
||||||
output.append(char)
|
output.append(char)
|
||||||
|
spinner.step()
|
||||||
|
|
||||||
current_time = time.time()
|
spinner.end()
|
||||||
if current_time - last_update >= update_interval:
|
|
||||||
print(f" Installing... {next(spinner)}", end="\r", flush=True)
|
|
||||||
last_update = current_time
|
|
||||||
|
|
||||||
return_code = process.wait()
|
return_code = process.wait()
|
||||||
output = "".join(output)
|
output = "".join(output)
|
||||||
|
|
||||||
if return_code == 0:
|
if return_code == 0:
|
||||||
print("\rInstallation complete.")
|
print("Installation complete.")
|
||||||
print()
|
print()
|
||||||
return True, output
|
return True, output
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue