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

Method handleWatchCommand

cli/command_handler_watch.go:21–41  ·  view source on GitHub ↗

handleWatchCommand routes /watch subcommands: start, stop, status.

(ctx context.Context, userInput string)

Source from the content-addressed store, hash-verified

19
20// handleWatchCommand routes /watch subcommands: start, stop, status.
21func (ch *CommandHandler) handleWatchCommand(ctx context.Context, userInput string) {
22 args := strings.Fields(userInput)
23
24 // /watch alone or /watch status
25 if len(args) < 2 || args[1] == "status" {
26 ch.handleWatchStatusCommand(ctx)
27 return
28 }
29
30 switch args[1] {
31 case "start":
32 ch.handleWatchStartCommand(ctx, args[2:])
33 case "stop":
34 ch.handleWatchStopCommand()
35 default:
36 fmt.Println(colorize(i18n.T("watch.usage.header"), ColorYellow))
37 fmt.Println(colorize(i18n.T("watch.usage.start"), ColorYellow))
38 fmt.Println(colorize(i18n.T("watch.usage.stop"), ColorYellow))
39 fmt.Println(colorize(i18n.T("watch.usage.status"), ColorYellow))
40 }
41}
42
43// handleWatchStartCommand starts a K8s watcher in background from interactive mode.
44func (ch *CommandHandler) handleWatchStartCommand(ctx context.Context, args []string) {

Callers 1

buildRoutesMethod · 0.95

Calls 5

TFunction · 0.92
colorizeFunction · 0.85

Tested by

no test coverage detected