Set is called when the --install-mode flag is passed to the CLI. It will configure the InstallMode based on the values passed in.
(str string)
| 35 | // Set is called when the --install-mode flag is passed to the CLI. It will |
| 36 | // configure the InstallMode based on the values passed in. |
| 37 | func (i *InstallMode) Set(str string) error { |
| 38 | split := strings.SplitN(str, "=", 2) |
| 39 | i.InstallModeType = v1alpha1.InstallModeType(split[0]) |
| 40 | if len(split) == 2 { |
| 41 | namespaces := strings.SplitSeq(split[1], ",") |
| 42 | for ns := range namespaces { |
| 43 | i.TargetNamespaces = append(i.TargetNamespaces, strings.TrimSpace(ns)) |
| 44 | } |
| 45 | sort.Strings(i.TargetNamespaces) |
| 46 | } else { |
| 47 | i.TargetNamespaces = []string{} |
| 48 | } |
| 49 | return i.Validate() |
| 50 | } |
| 51 | |
| 52 | // IsEmpty returns true if the InstallModeType is empty. |
| 53 | func (i InstallMode) IsEmpty() bool { |
no test coverage detected