Skip to content

Commit 67a3e4c

Browse files
Kasper JungeRalphify
authored andcommitted
refactor: replace print_error+typer.Exit pattern with error_exit in runner.py
Three call sites in runner.py used print_error() followed by raise typer.Exit(1), bypassing the error_exit() helper that already exists for this exact pattern. Switch to error_exit() throughout, which also lets the install_hint flow through the hint= parameter rather than a separate console.print call. Removes the now-unused typer, get_console, and print_error imports. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 24326d0 commit 67a3e4c

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

agr/runner.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
import subprocess
1212
import sys
1313

14-
import typer
15-
1614
from pathlib import Path
1715

18-
from agr.console import get_console, print_error
16+
from agr.console import error_exit
1917
from agr.tool import ToolConfig
2018

2119

@@ -38,16 +36,11 @@ def build_skill_prompt(
3836

3937
def check_tool_cli(tool_config: ToolConfig) -> None:
4038
"""Verify the tool's CLI is available, exiting with a clear error otherwise."""
41-
console = get_console()
4239
cli_cmd = tool_config.cli_command
4340
if not cli_cmd:
44-
print_error(f"{tool_config.name} has no CLI command configured")
45-
raise typer.Exit(1)
41+
error_exit(f"{tool_config.name} has no CLI command configured")
4642
if shutil.which(cli_cmd) is None:
47-
print_error(f"{cli_cmd} CLI not found.")
48-
if tool_config.install_hint:
49-
console.print(f"[dim]{tool_config.install_hint}[/dim]")
50-
raise typer.Exit(1)
43+
error_exit(f"{cli_cmd} CLI not found.", hint=tool_config.install_hint)
5144

5245

5346
def build_skill_command(
@@ -67,8 +60,7 @@ def build_skill_command(
6760
else:
6861
cli_cmd = tool_config.cli_command
6962
if cli_cmd is None:
70-
print_error(f"{tool_config.name} has no CLI command configured")
71-
raise typer.Exit(1)
63+
error_exit(f"{tool_config.name} has no CLI command configured")
7264
cmd = [cli_cmd]
7365
if not non_interactive and tool_config.cli_interactive_prompt_flag:
7466
cmd.extend([tool_config.cli_interactive_prompt_flag, skill_prompt])

0 commit comments

Comments
 (0)