handleWatchCommand routes /watch subcommands: start, stop, status.
(ctx context.Context, userInput string)
| 19 | |
| 20 | // handleWatchCommand routes /watch subcommands: start, stop, status. |
| 21 | func (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. |
| 44 | func (ch *CommandHandler) handleWatchStartCommand(ctx context.Context, args []string) { |
no test coverage detected