MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / runToolMenu

Function runToolMenu

internal/cli/launch.go:287–303  ·  view source on GitHub ↗

runToolMenu remains as a fallback used by tests that exercise the non-TTY rendering path of the legacy single-step menu. It is no longer wired into the launch command, but kept to avoid breaking the existing test that asserts on its output.

(out io.Writer, items []string)

Source from the content-addressed store, hash-verified

285// longer wired into the launch command, but kept to avoid breaking
286// the existing test that asserts on its output.
287func runToolMenu(out io.Writer, items []string) (string, error) {
288 model := newToolMenuModel(items)
289 file, ok := out.(*os.File)
290 if !ok || !isTerminal(file) {
291 _, err := fmt.Fprint(out, model.View())
292 return "", err
293 }
294 program := tea.NewProgram(model, tea.WithOutput(out))
295 finalModel, err := program.Run()
296 if err != nil {
297 return "", err
298 }
299 if menu, ok := finalModel.(toolMenuModel); ok {
300 return menu.selected, nil
301 }
302 return "", nil
303}
304
305func isTerminal(file *os.File) bool {
306 info, err := file.Stat()

Callers

nothing calls this directly

Calls 4

newToolMenuModelFunction · 0.85
isTerminalFunction · 0.85
RunMethod · 0.65
ViewMethod · 0.45

Tested by

no test coverage detected