File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ dependencies = [
99 " httpx" ,
1010 " openai" ,
1111 " prompt-toolkit" ,
12+ " yaspin" ,
1213 " tomlkit" ,
1314 " tomli >= 1.1.0; python_version < '3.11'"
1415]
Original file line number Diff line number Diff line change 55import sys
66from pathlib import Path
77
8+ from yaspin import yaspin
9+ from yaspin .spinners import Spinners
810from prompt_toolkit import PromptSession
911from prompt_toolkit .application import create_app_session_from_tty
1012from prompt_toolkit .history import FileHistory
@@ -57,8 +59,12 @@ async def shelloracle() -> None:
5759 default_prompt = os .environ .get ("SHOR_DEFAULT_PROMPT" )
5860 prompt = await prompt_user (default_prompt )
5961
60- async for token in provider .generate (prompt ):
61- sys .stdout .write (token )
62+ shell_command = ""
63+ with create_app_session_from_tty (), patch_stdout (raw = True ), yaspin () as sp :
64+ async for token in provider .generate (prompt ):
65+ shell_command += token
66+ sp .text = shell_command
67+ sys .stdout .write (shell_command )
6268
6369
6470def cli () -> None :
You can’t perform that action at this time.
0 commit comments