func NewComponentWatchCmd() (cmd *cobra.Command) {
	opt := &WatchOption{}
	cmd = &cobra.Command{
		Use:   "watch",
		Short: "Update images of ks-apiserver, ks-controller-manager, ks-console",
		Example: `In order to make it be simple, please add the following environment variables
export KS_PRIVATE_LOCAL=192.168.0.8
export KS_REPO=139.198.3.176:32678
ks ks com watch --watch-deploy apiserver --watch-tag fix-pipe-list --registry private`,
		PreRunE: opt.watchPreRunE,
		RunE:    opt.watchRunE,
	}
	flags := cmd.Flags()
	flags.BoolVarP(&opt.Release, "release", "r", true,
		"Indicate if you want to update KubeSphere deploy image to release. Released images come from kubesphere/xxx. Otherwise images come from kubespheredev/xxx")
	flags.StringVarP(&opt.Tag, "tag", "t", kstypes.KsVersion,
		"The tag of KubeSphere deploys")
	flags.BoolVarP(&opt.Watch, "watch", "w", false,
		"Watch a container image then update it")
	flags.StringVarP(&opt.WatchDeploy, "watch-deploy", "", "",
		"Watch a deploy then update it")
	flags.StringVarP(&opt.WatchImage, "watch-image", "", "",
		"which image you want to watch")
	flags.StringVarP(&opt.WatchTag, "watch-tag", "", "",
		"which image tag you want to watch")
	flags.StringVarP(&opt.Registry, "registry", "", "docker",
		"supported list [docker, aliyun, qingcloud, private], we only support beijing area of aliyun")
	flags.StringVarP(&opt.PrivateRegistry, "private-registry", "", "",
		`a private registry, for example: docker run -d -p 5000:5000 --restart always --name registry registry:2
take value from environment 'KS_REPO' if you don't set it`)
	flags.StringVarP(&opt.PrivateLocal, "private-local", "", "127.0.0.1",
		`The local address of registry
take value from environment 'KS_PRIVATE_LOCAL' if you don't set it`)
	_ = cmd.RegisterFlagCompletionFunc("watch-deploy", common.ArrayCompletion("apiserver", "controller", "console"))
	_ = cmd.RegisterFlagCompletionFunc("registry", common.ArrayCompletion("docker", " aliyun", "qingcloud", "private"))
	return
}
NewComponentWatchCmd returns a command to enable (or disable) a component by name
package component
import (
	"context"
	"fmt"
	"github.com/kubesphere-sigs/ks/kubectl-plugin/common"
	kstypes "github.com/kubesphere-sigs/ks/kubectl-plugin/types"
	"github.com/spf13/cobra"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"os"
	"os/exec"
	"os/signal"
	"strings"
	"time"
)