mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +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,
|
||||
universal_newlines=True,
|
||||
)
|
||||
spinner = itertools.cycle(["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"])
|
||||
last_update = time.time()
|
||||
update_interval = 0.2 # 5 times per second
|
||||
spinner = Spinner("Installing...")
|
||||
|
||||
while True:
|
||||
char = process.stdout.read(1)
|
||||
|
@ -217,17 +215,14 @@ def run_install(cmd):
|
|||
break
|
||||
|
||||
output.append(char)
|
||||
spinner.step()
|
||||
|
||||
current_time = time.time()
|
||||
if current_time - last_update >= update_interval:
|
||||
print(f" Installing... {next(spinner)}", end="\r", flush=True)
|
||||
last_update = current_time
|
||||
|
||||
spinner.end()
|
||||
return_code = process.wait()
|
||||
output = "".join(output)
|
||||
|
||||
if return_code == 0:
|
||||
print("\rInstallation complete.")
|
||||
print("Installation complete.")
|
||||
print()
|
||||
return True, output
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue