fix(service): render request_input prompt via rich console

This commit is contained in:
imSp4rky
2026-05-16 16:43:47 -06:00
parent f26f9bcbe2
commit 34a6e2d8e2

View File

@@ -17,6 +17,7 @@ import requests
from requests.adapters import HTTPAdapter, Retry
from rich.padding import Padding
from rich.rule import Rule
from rich.text import Text
from unshackle.core.cacher import Cacher
from unshackle.core.config import config
@@ -359,13 +360,16 @@ class Service(metaclass=ABCMeta):
def request_input(self, prompt: str) -> str:
"""Request interactive input from the user.
When running locally (CLI), falls back to ``input()``.
When running locally (CLI), prompts via the shared rich console so the
prompt renders correctly alongside Live progress / log handlers.
When running in serve mode with an :class:`InputBridge` attached,
delegates to the bridge which relays the prompt to the remote client.
"""
if self._input_bridge is not None:
return self._input_bridge.request_input(prompt)
return input(prompt)
indent = " " * 5
padded = indent + prompt.replace("\n", "\n" + indent)
return console.input(Text(padded, style="text"))
def search(self) -> Generator[SearchResult, None, None]:
"""