MCPcopy Create free account
hub / github.com/diillson/chatcli / handleWebSearchCommand

Method handleWebSearchCommand

cli/websearch_command.go:23–48  ·  view source on GitHub ↗

handleWebSearchCommand routes /websearch subcommands. /websearch → current status + chain /websearch list → all known providers + configured? /websearch provider → override for this session (sets env var) /websearch reset → clear override → back to auto

(userInput string)

Source from the content-addressed store, hash-verified

21// /websearch provider <name> → override for this session (sets env var)
22// /websearch reset → clear override → back to auto
23func (cli *ChatCLI) handleWebSearchCommand(userInput string) {
24 args := strings.Fields(userInput)
25 if len(args) == 1 {
26 cli.showWebSearchStatus()
27 return
28 }
29 switch args[1] {
30 case "list", "ls":
31 cli.showWebSearchList()
32 case "provider", "set", "use":
33 if len(args) < 3 {
34 fmt.Println(colorize(" "+i18n.T("ws.cmd.usage_provider"), ColorYellow))
35 return
36 }
37 cli.setWebSearchProvider(args[2])
38 case "reset", "clear":
39 _ = os.Unsetenv("CHATCLI_WEBSEARCH_PROVIDER")
40 fmt.Println(colorize(" "+i18n.T("ws.cmd.override_cleared"), ColorGreen))
41 cli.showWebSearchStatus()
42 case "status":
43 cli.showWebSearchStatus()
44 default:
45 fmt.Println(colorize(" "+i18n.T("ws.cmd.unknown_sub", args[1]), ColorYellow))
46 fmt.Println(colorize(" "+i18n.T("ws.cmd.usage_hint"), ColorGray))
47 }
48}
49
50// showWebSearchStatus prints the current override, SearxNG config, and the
51// active fallback chain that a query would actually use right now.

Callers 1

buildRoutesMethod · 0.80

Calls 5

showWebSearchStatusMethod · 0.95
showWebSearchListMethod · 0.95
setWebSearchProviderMethod · 0.95
TFunction · 0.92
colorizeFunction · 0.85

Tested by

no test coverage detected