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 = [
9
9
" httpx" ,
10
10
" openai" ,
11
11
" prompt-toolkit" ,
12
+ " yaspin" ,
12
13
" tomlkit" ,
13
14
" tomli >= 1.1.0; python_version < '3.11'"
14
15
]
Original file line number Diff line number Diff line change 5
5
import sys
6
6
from pathlib import Path
7
7
8
+ from yaspin import yaspin
9
+ from yaspin .spinners import Spinners
8
10
from prompt_toolkit import PromptSession
9
11
from prompt_toolkit .application import create_app_session_from_tty
10
12
from prompt_toolkit .history import FileHistory
@@ -57,8 +59,12 @@ async def shelloracle() -> None:
57
59
default_prompt = os .environ .get ("SHOR_DEFAULT_PROMPT" )
58
60
prompt = await prompt_user (default_prompt )
59
61
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 )
62
68
63
69
64
70
def cli () -> None :
You can’t perform that action at this time.
0 commit comments