MCPcopy Create free account
hub / github.com/RightNow-AI/rightnow-cli / _configure_path

Function _configure_path

rightnow_cli/ui/setup_wizard.py:146–215  ·  view source on GitHub ↗

Configure a single compiler path interactively. Args: name: Display name of the tool tool_info: Auto-detected tool information executable_name: Name of the executable to look for optional: Whether this tool is optional Returns: Configured path o

(
    name: str,
    tool_info: ToolInfo,
    executable_name: str,
    optional: bool = False
)

Source from the content-addressed store, hash-verified

144
145
146def _configure_path(
147 name: str,
148 tool_info: ToolInfo,
149 executable_name: str,
150 optional: bool = False
151) -> Optional[str]:
152 """
153 Configure a single compiler path interactively.
154
155 Args:
156 name: Display name of the tool
157 tool_info: Auto-detected tool information
158 executable_name: Name of the executable to look for
159 optional: Whether this tool is optional
160
161 Returns:
162 Configured path or None
163 """
164 # Show current status
165 if tool_info.available:
166 console.print(f"[green]✓[/green] [bold]{name}[/bold]")
167 console.print(f" [dim]Auto-detected: {tool_info.path}[/dim]")
168 default_path = tool_info.path
169 else:
170 console.print(f"[yellow]![/yellow] [bold]{name}[/bold]")
171 console.print(f" [dim]Not auto-detected[/dim]")
172 if tool_info.error:
173 console.print(f" [dim]Tip: {tool_info.error}[/dim]")
174 default_path = ""
175
176 # Get user input
177 if optional:
178 prompt_text = f" Path (optional, press Enter to skip)"
179 else:
180 prompt_text = f" Path"
181
182 user_input = Prompt.ask(
183 prompt_text,
184 default=default_path if default_path else ""
185 ).strip()
186
187 # Validate path
188 if user_input:
189 path = Path(user_input)
190 if path.exists():
191 console.print(f" [green]✓ Valid path[/green]\n")
192 return str(path)
193 else:
194 console.print(f" [red]✗ Path does not exist[/red]")
195 # Ask if they want to retry
196 retry = Prompt.ask(
197 " Try again?",
198 choices=["yes", "no"],
199 default="no"
200 )
201 if retry == "yes":
202 return _configure_path(name, tool_info, executable_name, optional)
203 console.print()

Callers 1

run_setup_wizardFunction · 0.85

Calls 2

askMethod · 0.80
existsMethod · 0.80

Tested by

no test coverage detected