CLI quality of life improvements (#189)
Small QOL improvements: graceful messages in error situations
This commit is contained in:
parent
f7f5888b21
commit
179837f7fb
2 changed files with 12 additions and 3 deletions
|
|
@ -16,6 +16,10 @@ def display_tools_table(tools: list[ToolDefinition]) -> None:
|
||||||
"""
|
"""
|
||||||
Display a table of tools with their name, description, package, and version.
|
Display a table of tools with their name, description, package, and version.
|
||||||
"""
|
"""
|
||||||
|
if not tools:
|
||||||
|
console.print("No tools found.", style="bold")
|
||||||
|
return
|
||||||
|
|
||||||
table = Table(show_header=True, header_style="bold magenta")
|
table = Table(show_header=True, header_style="bold magenta")
|
||||||
table.add_column("Name")
|
table.add_column("Name")
|
||||||
table.add_column("Description")
|
table.add_column("Description")
|
||||||
|
|
|
||||||
|
|
@ -198,9 +198,14 @@ def get_tools_from_engine(
|
||||||
client = Arcade(api_key=config.api.key, base_url=base_url)
|
client = Arcade(api_key=config.api.key, base_url=base_url)
|
||||||
|
|
||||||
tools = []
|
tools = []
|
||||||
page_iterator = client.tools.list(toolkit=toolkit or NOT_GIVEN)
|
try:
|
||||||
for tool in page_iterator:
|
page_iterator = client.tools.list(toolkit=toolkit or NOT_GIVEN)
|
||||||
tools.append(ToolDefinition.model_validate(tool.model_dump()))
|
for tool in page_iterator:
|
||||||
|
tools.append(ToolDefinition.model_validate(tool.model_dump()))
|
||||||
|
except APIConnectionError:
|
||||||
|
console.print(
|
||||||
|
f"❌ Can't connect to Arcade Engine at {base_url}. (Is it running?)", style="bold red"
|
||||||
|
)
|
||||||
|
|
||||||
return tools
|
return tools
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue