Closed niravpatel27 closed 6 years ago
I'm not sure what Rancher has in store for naming these in the future.
We've had situations where we need to use a display name while leveraging a different value for the underlying terraform config. Example here
Thoughts on leveraging something like this instead?
var kubernetesVersions = []struct {
DisplayName string
Name string
}{
{"v1.8.10", "v1.8.10-rancher1-1"},
{"v1.9.5", "v1.9.5-rancher1-1"},
{"v1.10.0", "v1.10.0-rancher1-1"},
}
prompt := promptui.Select{
Label: "Kubernetes Version",
Items: kubernetesVersions,
Templates: &promptui.SelectTemplates{
Label: "{{ . }}?",
Active: fmt.Sprintf(`%s {{ .DisplayName | underline }}`, promptui.IconSelect),
Inactive: ` {{ .DisplayName }}`,
Selected: fmt.Sprintf(`{{ "%s" | green }} {{ "Kubernetes Version:" | bold}} {{ .DisplayName }}`, promptui.IconGood),
},
}
i, _, err := prompt.Run()
if err != nil {
return baseClusterTerraformConfig{}, err
}
cfg.KubernetesVersion = kubernetesVersions[i].Name
@nimajalali Good point. I have made changes.
:+1: looks good to me
@nimajalali